Mercurial > libavformat.hg
changeset 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 | 87148b96d649 |
children | abbc781d608a |
files | asf.c |
diffstat | 1 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/asf.c Sun Mar 11 02:51:06 2007 +0000 +++ b/asf.c Sun Mar 11 03:36:17 2007 +0000 @@ -167,6 +167,16 @@ print_guid(&g); printf(" size=0x%"PRIx64"\n", gsize); #endif + if (!memcmp(&g, &data_header, sizeof(GUID))) { + asf->data_object_offset = url_ftell(pb); + // if not streaming, gsize is not unlimited (how?), and there is enough space in the file.. + if (!(asf->hdr.flags & 0x01) && gsize >= 100) { + asf->data_object_size = gsize - 24; + } else { + asf->data_object_size = (uint64_t)-1; + } + break; + } if (gsize < 24) goto fail; if (!memcmp(&g, &file_header, sizeof(GUID))) { @@ -327,15 +337,6 @@ } pos2 = url_ftell(pb); url_fskip(pb, gsize - (pos2 - pos1 + 24)); - } else if (!memcmp(&g, &data_header, sizeof(GUID))) { - asf->data_object_offset = url_ftell(pb); - // if not streaming, gsize is not unlimited (how?), and there is enough space in the file.. - if (!(asf->hdr.flags & 0x01) && gsize != (uint64_t)-1 && gsize >= 24) { - asf->data_object_size = gsize - 24; - } else { - asf->data_object_size = (uint64_t)-1; - } - break; } else if (!memcmp(&g, &comment_header, sizeof(GUID))) { int len1, len2, len3, len4, len5;