[FFmpeg-cvslog] mss2: do not try to read too many palette entries

Alberto Delmás git at videolan.org
Fri Sep 7 13:50:44 CEST 2012


ffmpeg | branch: master | Alberto Delmás <adelmas at gmail.com> | Mon Sep  3 17:28:01 2012 +0200| [6ceef07b21a6b828d98f25edefb66e322a628667] | committer: Kostya Shishkov

mss2: do not try to read too many palette entries

Reported by Michael Niedermayer <michaelni at gmx.at>

Signed-off-by: Kostya Shishkov <kostya.shishkov at gmail.com>

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

 libavcodec/mss2.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c
index ce3cfb8..9914562 100644
--- a/libavcodec/mss2.c
+++ b/libavcodec/mss2.c
@@ -161,7 +161,7 @@ static int decode_pal_v2(MSS12Context *ctx, const uint8_t *buf, int buf_size)
         return 0;
 
     ncol = *buf++;
-    if (buf_size < 2 + ncol * 3)
+    if (ncol > ctx->free_colours || buf_size < 2 + ncol * 3)
         return -1;
     for (i = 0; i < ncol; i++)
         *pal++ = AV_RB24(buf + 3 * i);



More information about the ffmpeg-cvslog mailing list