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:
parent
19fb476841
commit
436206c175
@ -1065,6 +1065,7 @@ static int apply_color_indexing_transform(WebPContext *s)
|
|||||||
if (img->frame->height * img->frame->width > 300) {
|
if (img->frame->height * img->frame->width > 300) {
|
||||||
uint8_t palette[256 * 4];
|
uint8_t palette[256 * 4];
|
||||||
const int size = pal->frame->width * 4;
|
const int size = pal->frame->width * 4;
|
||||||
|
av_assert0(size <= 1024U);
|
||||||
memcpy(palette, GET_PIXEL(pal->frame, 0, 0), size); // copy palette
|
memcpy(palette, GET_PIXEL(pal->frame, 0, 0), size); // copy palette
|
||||||
// set extra entries to transparent black
|
// set extra entries to transparent black
|
||||||
memset(palette + size, 0, 256 * 4 - size);
|
memset(palette + size, 0, 256 * 4 - size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user