[FFmpeg-cvslog] vqa: check palette chunk size before reading data.

Ronald S. Bultje git at videolan.org
Thu May 3 00:26:18 CEST 2012


ffmpeg | branch: release/0.10 | Ronald S. Bultje <rsbultje at gmail.com> | Wed Mar 21 15:19:31 2012 -0700| [c21b858b278df60c849d86701019e7d096b0c1f4] | committer: Reinhard Tartler

vqa: check palette chunk size before reading data.

Prevents overreads beyond buffer boundaries.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
(cherry picked from commit 75d7975268394f4f16294b68ec6d6d5ac30da3ac)

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

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

 libavcodec/vqavideo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c
index 9801167..bc1ff27 100644
--- a/libavcodec/vqavideo.c
+++ b/libavcodec/vqavideo.c
@@ -385,7 +385,7 @@ static int vqa_decode_chunk(VqaContext *s)
         bytestream2_seek(&s->gb, cpl0_chunk, SEEK_SET);
         chunk_size = bytestream2_get_be32(&s->gb);
         /* sanity check the palette size */
-        if (chunk_size / 3 > 256) {
+        if (chunk_size / 3 > 256 || chunk_size > bytestream2_get_bytes_left(&s->gb)) {
             av_log(s->avctx, AV_LOG_ERROR, "  VQA video: problem: found a palette chunk with %d colors\n",
                 chunk_size / 3);
             return AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list