comparison ifo_read.c @ 83:bed968b9bd99 src

If the start offset points past the last_byte (outside the region read) stop reading PTTs and adjust nr_of_srpts. Fixes Transformers 3 and Cars 2. Patch by John Stebbins ^stebbins*jetheaddev+com/
author rathann
date Thu, 03 Oct 2013 21:57:48 +0000
parents 7299649d578f
children 1a6394166cce
comparison
equal deleted inserted replaced
82:aa4a7b151801 83:bed968b9bd99
1183 if(vts_ptt_srpt->nr_of_srpts > info_length / sizeof(*data)) { 1183 if(vts_ptt_srpt->nr_of_srpts > info_length / sizeof(*data)) {
1184 fprintf(stderr, "libdvdread: PTT search table too small.\n"); 1184 fprintf(stderr, "libdvdread: PTT search table too small.\n");
1185 goto fail; 1185 goto fail;
1186 } 1186 }
1187 for(i = 0; i < vts_ptt_srpt->nr_of_srpts; i++) { 1187 for(i = 0; i < vts_ptt_srpt->nr_of_srpts; i++) {
1188 B2N_32(data[i]); 1188 /* Transformers 3 has PTT start bytes that point outside the SRPT PTT */
1189 uint32_t start = data[i];
1190 B2N_32(start);
1191 if(start + sizeof(ptt_info_t) > vts_ptt_srpt->last_byte + 1) {
1192 /* don't mess with any bytes beyond the end of the allocation */
1193 vts_ptt_srpt->nr_of_srpts = i;
1194 break;
1195 }
1196 data[i] = start;
1189 /* assert(data[i] + sizeof(ptt_info_t) <= vts_ptt_srpt->last_byte + 1); 1197 /* assert(data[i] + sizeof(ptt_info_t) <= vts_ptt_srpt->last_byte + 1);
1190 Magic Knight Rayearth Daybreak is mastered very strange and has 1198 Magic Knight Rayearth Daybreak is mastered very strange and has
1191 Titles with 0 PTTs. They all have a data[i] offsets beyond the end of 1199 Titles with 0 PTTs. They all have a data[i] offsets beyond the end of
1192 of the vts_ptt_srpt structure. */ 1200 of the vts_ptt_srpt structure. */
1193 CHECK_VALUE(data[i] + sizeof(ptt_info_t) <= vts_ptt_srpt->last_byte + 1 + 4); 1201 CHECK_VALUE(data[i] + sizeof(ptt_info_t) <= vts_ptt_srpt->last_byte + 1 + 4);