Mercurial > libavformat.hg
comparison asf.c @ 1896:6d2157d1fc93 libavformat
fix gsize=0 / -1 case (if(<24) goto fail) before it is not a good idea
author | michael |
---|---|
date | Sun, 11 Mar 2007 03:36:17 +0000 |
parents | 9bc07f90d4a2 |
children | 48878515666c |
comparison
equal
deleted
inserted
replaced
1895:87148b96d649 | 1896:6d2157d1fc93 |
---|---|
165 #ifdef DEBUG | 165 #ifdef DEBUG |
166 printf("%08"PRIx64": ", url_ftell(pb) - 24); | 166 printf("%08"PRIx64": ", url_ftell(pb) - 24); |
167 print_guid(&g); | 167 print_guid(&g); |
168 printf(" size=0x%"PRIx64"\n", gsize); | 168 printf(" size=0x%"PRIx64"\n", gsize); |
169 #endif | 169 #endif |
170 if (!memcmp(&g, &data_header, sizeof(GUID))) { | |
171 asf->data_object_offset = url_ftell(pb); | |
172 // if not streaming, gsize is not unlimited (how?), and there is enough space in the file.. | |
173 if (!(asf->hdr.flags & 0x01) && gsize >= 100) { | |
174 asf->data_object_size = gsize - 24; | |
175 } else { | |
176 asf->data_object_size = (uint64_t)-1; | |
177 } | |
178 break; | |
179 } | |
170 if (gsize < 24) | 180 if (gsize < 24) |
171 goto fail; | 181 goto fail; |
172 if (!memcmp(&g, &file_header, sizeof(GUID))) { | 182 if (!memcmp(&g, &file_header, sizeof(GUID))) { |
173 get_guid(pb, &asf->hdr.guid); | 183 get_guid(pb, &asf->hdr.guid); |
174 asf->hdr.file_size = get_le64(pb); | 184 asf->hdr.file_size = get_le64(pb); |
325 if(tag1 == MKTAG('D', 'V', 'R', ' ')) | 335 if(tag1 == MKTAG('D', 'V', 'R', ' ')) |
326 st->need_parsing = 1; | 336 st->need_parsing = 1; |
327 } | 337 } |
328 pos2 = url_ftell(pb); | 338 pos2 = url_ftell(pb); |
329 url_fskip(pb, gsize - (pos2 - pos1 + 24)); | 339 url_fskip(pb, gsize - (pos2 - pos1 + 24)); |
330 } else if (!memcmp(&g, &data_header, sizeof(GUID))) { | |
331 asf->data_object_offset = url_ftell(pb); | |
332 // if not streaming, gsize is not unlimited (how?), and there is enough space in the file.. | |
333 if (!(asf->hdr.flags & 0x01) && gsize != (uint64_t)-1 && gsize >= 24) { | |
334 asf->data_object_size = gsize - 24; | |
335 } else { | |
336 asf->data_object_size = (uint64_t)-1; | |
337 } | |
338 break; | |
339 } else if (!memcmp(&g, &comment_header, sizeof(GUID))) { | 340 } else if (!memcmp(&g, &comment_header, sizeof(GUID))) { |
340 int len1, len2, len3, len4, len5; | 341 int len1, len2, len3, len4, len5; |
341 | 342 |
342 len1 = get_le16(pb); | 343 len1 = get_le16(pb); |
343 len2 = get_le16(pb); | 344 len2 = get_le16(pb); |