From ddfe1246d98f70cdce368a2176196ba26ed7bf2d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 14 Feb 2013 12:40:36 +0100 Subject: [PATCH 1/2] 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@libav.org --- libavcodec/flicvideo.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c index f0b5d50d02..08c3ef32a8 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); From 56daf10e0313c5e36f43e773f457d2a99ff0df10 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 14 Feb 2013 12:47:43 +0100 Subject: [PATCH 2/2] mov: use the format context for logging. CC:libav-stable@libav.org --- libavformat/mov.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index d5a75c40eb..7fe0548daa 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -718,7 +718,7 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) version = avio_r8(pb); if (version > 1) { - av_log_ask_for_sample(c, "unsupported version %d\n", version); + av_log_ask_for_sample(c->fc, "unsupported version %d\n", version); return AVERROR_PATCHWELCOME; } avio_rb24(pb); /* flags */