[FFmpeg-cvslog] lagarith: avoid infinite loop in lag_rac_refill()

Anton Khirnov git at videolan.org
Sun Feb 24 13:09:17 CET 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Feb 14 08:47:17 2013 +0100| [de6dfa2bb82df916a67e5036b0ef96a944781ed3] | committer: Anton Khirnov

lagarith: avoid infinite loop in lag_rac_refill()

range == 0 happens with corrupted files

CC:libav-stable at libav.org

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=de6dfa2bb82df916a67e5036b0ef96a944781ed3
---

 libavcodec/lagarithrac.h |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/lagarithrac.h b/libavcodec/lagarithrac.h
index aa36d38..e4f066e 100644
--- a/libavcodec/lagarithrac.h
+++ b/libavcodec/lagarithrac.h
@@ -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;



More information about the ffmpeg-cvslog mailing list