1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/webp: add assert to ensure palette is not larger than 256

it should not be possible to be larger as its stored as 8bit value
but we would be overwriting a stack buffer if it is ...

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-10-05 13:00:40 +02:00
parent 19fb476841
commit 436206c175

View File

@ -1065,6 +1065,7 @@ static int apply_color_indexing_transform(WebPContext *s)
if (img->frame->height * img->frame->width > 300) {
uint8_t palette[256 * 4];
const int size = pal->frame->width * 4;
av_assert0(size <= 1024U);
memcpy(palette, GET_PIXEL(pal->frame, 0, 0), size); // copy palette
// set extra entries to transparent black
memset(palette + size, 0, 256 * 4 - size);