]> git.sesse.net Git - ffmpeg/commitdiff
lagarith: avoid infinite loop in lag_rac_refill()
authorAnton Khirnov <anton@khirnov.net>
Thu, 14 Feb 2013 07:47:17 +0000 (08:47 +0100)
committerAnton Khirnov <anton@khirnov.net>
Sat, 23 Feb 2013 08:16:32 +0000 (09:16 +0100)
range == 0 happens with corrupted files

CC:libav-stable@libav.org

libavcodec/lagarithrac.h

index aa36d38f8533cd877d5bd766819378bce832e804..e4f066e445b69978f9d047e80902b2645002f8d6 100644 (file)
@@ -107,6 +107,9 @@ static inline uint8_t lag_get_rac(lag_rac *l)
         l->range -= range_scaled * l->prob[255];
     }
 
+    if (!l->range)
+        l->range = 0x80;
+
     l->low -= range_scaled * l->prob[val];
 
     return val;