[FFmpeg-cvslog] lzw: check for overread

Michael Niedermayer git at videolan.org
Sun Apr 15 18:26:36 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Apr 15 18:13:50 2012 +0200| [44c4170c52c10e3da3a7ea8e3435ef37c4edc2cc] | committer: Michael Niedermayer

lzw: check for overread

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/lzw.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavcodec/lzw.c b/libavcodec/lzw.c
index 348d2de..19f3e11 100644
--- a/libavcodec/lzw.c
+++ b/libavcodec/lzw.c
@@ -190,6 +190,10 @@ int ff_lzw_decode(LZWState *p, uint8_t *buf, int len){
             if ((--l) == 0)
                 goto the_end;
         }
+        if (s->ebuf < s->pbuf) {
+            av_log(0, AV_LOG_ERROR, "lzw overread\n");
+            goto the_end;
+        }
         c = lzw_get_code(s);
         if (c == s->end_code) {
             break;



More information about the ffmpeg-cvslog mailing list