[FFmpeg-cvslog] pictordec: break out of both decoding loops when y drops below 0

Anton Khirnov git at videolan.org
Tue Sep 3 14:13:51 CEST 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Aug 24 21:30:46 2013 +0200| [5f7aecde02a95451e514c809f2794c1deba80695] | committer: Anton Khirnov

pictordec: break out of both decoding loops when y drops below 0

Otherwise picmemset can get called with negative y, resulting in an
invalid write.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org

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

 libavcodec/pictordec.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c
index 2a6e391..20ddb20 100644
--- a/libavcodec/pictordec.c
+++ b/libavcodec/pictordec.c
@@ -226,7 +226,7 @@ static int decode_frame(AVCodecContext *avctx,
                 if (bits_per_plane == 8) {
                     picmemset_8bpp(s, frame, val, run, &x, &y);
                     if (y < 0)
-                        break;
+                        goto finish;
                 } else {
                     picmemset(s, frame, val, run, &x, &y, &plane, bits_per_plane);
                 }
@@ -236,6 +236,7 @@ static int decode_frame(AVCodecContext *avctx,
         avpriv_request_sample(s, "Uncompressed image");
         return avpkt->size;
     }
+finish:
 
     *got_frame      = 1;
     return avpkt->size;



More information about the ffmpeg-cvslog mailing list