lagarith: avoid infinite loop in lag_rac_refill()
authorAnton Khirnov <anton@khirnov.net>
Thu, 14 Feb 2013 07:47:17 +0000 (08:47 +0100)
committerReinhard Tartler <siretart@tauware.de>
Sat, 23 Feb 2013 13:40:04 +0000 (14:40 +0100)
range == 0 happens with corrupted files

CC:libav-stable@libav.org
(cherry picked from commit de6dfa2bb82df916a67e5036b0ef96a944781ed3)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
libavcodec/lagarithrac.h

index aa36d38..e4f066e 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;