aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-03-11 03:36:17 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-03-11 03:36:17 +0000
commit09d9672ad66f5afde4907ad18bbddb16ddf4ad85 (patch)
tree713779c3aa64b1bb9457f6f1513f8475a63187d2
parente1315fb1607aac61463102c45d51099c813689ad (diff)
downloadffmpeg-09d9672ad66f5afde4907ad18bbddb16ddf4ad85.tar.gz
fix gsize=0 / -1 case (if(<24) goto fail) before it is not a good idea
Originally committed as revision 8320 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/asf.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/libavformat/asf.c b/libavformat/asf.c
index 151a52a734..a9531efe7c 100644
--- a/libavformat/asf.c
+++ b/libavformat/asf.c
@@ -167,6 +167,16 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
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 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
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;