Skip to content

Commit 85d23e5

Browse files
committed
avcodec/interplayvideo: Check side data size before use
Fixes out of array read Found-by: Thomas Garnier using libFuzzer Signed-off-by: Michael Niedermayer <[email protected]>
1 parent c117343 commit 85d23e5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

libavcodec/interplayvideo.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -1013,10 +1013,13 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
10131013
return ret;
10141014

10151015
if (!s->is_16bpp) {
1016-
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
1017-
if (pal) {
1016+
int size;
1017+
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
1018+
if (pal && size == AVPALETTE_SIZE) {
10181019
frame->palette_has_changed = 1;
10191020
memcpy(s->pal, pal, AVPALETTE_SIZE);
1021+
} else if (pal) {
1022+
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
10201023
}
10211024
}
10221025

0 commit comments

Comments
 (0)