[FFmpeg-cvslog] flicvideo: avoid an infinite loop in byte run compression

Anton Khirnov git at videolan.org
Tue Feb 26 03:39:01 CET 2013


ffmpeg | branch: release/1.1 | Anton Khirnov <anton at khirnov.net> | Thu Feb 14 12:40:36 2013 +0100| [612b28194b4c1fb55c8620a8cddf77ea6e81b9bf] | committer: Reinhard Tartler

flicvideo: avoid an infinite loop in byte run compression

When byte_run is 0, pixel_countdown is not touched and the loop will run
forever.

CC:libav-stable at libav.org
(cherry picked from commit ddfe1246d98f70cdce368a2176196ba26ed7bf2d)

Signed-off-by: Reinhard Tartler <siretart at tauware.de>

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

 libavcodec/flicvideo.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c
index d2cc6cd..0841335 100644
--- a/libavcodec/flicvideo.c
+++ b/libavcodec/flicvideo.c
@@ -348,6 +348,11 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx,
                 pixel_countdown = s->avctx->width;
                 while (pixel_countdown > 0) {
                     byte_run = sign_extend(bytestream2_get_byte(&g2), 8);
+                    if (!byte_run) {
+                        av_log(avctx, AV_LOG_ERROR, "Invalid byte run value.\n");
+                        return AVERROR_INVALIDDATA;
+                    }
+
                     if (byte_run > 0) {
                         palette_idx1 = bytestream2_get_byte(&g2);
                         CHECK_PIXEL_PTR(byte_run);



More information about the ffmpeg-cvslog mailing list