Commit 6ceef07b authored by Alberto Delmás's avatar Alberto Delmás Committed by Kostya Shishkov

mss2: do not try to read too many palette entries

Reported by Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: 's avatarKostya Shishkov <kostya.shishkov@gmail.com>
parent 59383d57
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment