asfdec_o: prevent overflow causing seekback
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Wed, 6 Jan 2016 13:09:22 +0000 (14:09 +0100)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Thu, 14 Jan 2016 23:38:50 +0000 (00:38 +0100)
This fixes infinite loops.

Reviewed-by: Alexandra Hájková <alexandra.khirnova@gmail.com>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavformat/asfdec_o.c

index bc168d3..b81519f 100644 (file)
@@ -167,7 +167,7 @@ static void swap_guid(ff_asf_guid guid)
 
 static void align_position(AVIOContext *pb,  int64_t offset, uint64_t size)
 {
-    if (avio_tell(pb) != offset + size)
+    if (size < INT64_MAX - offset && avio_tell(pb) != offset + size)
         avio_seek(pb, offset + size, SEEK_SET);
 }