Skip to content

Commit

Permalink
avcodec/interplayvideo: Check side data size before use
Browse files Browse the repository at this point in the history
Fixes out of array read

Found-by: Thomas Garnier using libFuzzer
Signed-off-by: Michael Niedermayer <[email protected]>
  • Loading branch information
michaelni committed Oct 25, 2016
1 parent c117343 commit 85d23e5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libavcodec/interplayvideo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1013,10 +1013,13 @@ static int ipvideo_decode_frame(AVCodecContext *avctx,
return ret;

if (!s->is_16bpp) {
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
if (pal) {
int size;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size);
if (pal && size == AVPALETTE_SIZE) {
frame->palette_has_changed = 1;
memcpy(s->pal, pal, AVPALETTE_SIZE);
} else if (pal) {
av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size);
}
}

Expand Down

0 comments on commit 85d23e5

Please sign in to comment.