[libdvdnav-devel] [Git][videolan/libdvdread][master] 2 commits: ifo_read: read the PTT entries without an unaligned cast

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon Aug 10 20:41:01 UTC 2026



Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdread


Commits:
c1de9313 by Saifelden Mohamed Ismail at 2026-08-10T15:34:56+03:00
ifo_read: read the PTT entries without an unaligned cast

- - - - -
f1e207f5 by Saifelden Mohamed Ismail at 2026-08-10T15:35:34+03:00
ifo_read: don't read PTT entries past the end of the buffer

- - - - -


1 changed file:

- src/ifo_read.c


Changes:

=====================================
src/ifo_read.c
=====================================
@@ -2582,12 +2582,19 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) {
       goto fail;
     }
     for(j = 0; j < vts_ptt_srpt->title[i].nr_of_ptts; j++) {
+      uint32_t entry_offset = data[i] + 4*j - VTS_PTT_SRPT_SIZE;
+      const char *entry;
+
       /* The assert placed here because of Magic Knight Rayearth Daybreak */
       CHECK_VALUE(data[i] + sizeof(ptt_info_t) <= vts_ptt_srpt->last_byte + 1);
-      vts_ptt_srpt->title[i].ptt[j].pgcn
-        = *(uint16_t*)(((char *)data) + data[i] + 4*j - VTS_PTT_SRPT_SIZE);
-      vts_ptt_srpt->title[i].ptt[j].pgn
-        = *(uint16_t*)(((char *)data) + data[i] + 4*j + 2 - VTS_PTT_SRPT_SIZE);
+      if(data[i] < VTS_PTT_SRPT_SIZE ||
+         entry_offset + PTT_INFO_SIZE > (uint32_t)info_length) {
+        vts_ptt_srpt->title[i].nr_of_ptts = j;
+        break;
+      }
+      entry = (const char *)data + entry_offset;
+      memcpy(&vts_ptt_srpt->title[i].ptt[j].pgcn, entry, 2);
+      memcpy(&vts_ptt_srpt->title[i].ptt[j].pgn, entry + 2, 2);
     }
   }
 



View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/compare/50009a0e36bb3c0d55fcbeb4837999ab8f4e657b...f1e207f51b9e0a916a2030dce6d27e44056c7f8f

-- 
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/compare/50009a0e36bb3c0d55fcbeb4837999ab8f4e657b...f1e207f51b9e0a916a2030dce6d27e44056c7f8f
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the libdvdnav-devel mailing list