avcodec/motionpixels: Mask pixels to valid values

Fixes: out of array access
Fixes: 48567/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOTIONPIXELS_fuzzer-6724203352555520

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/389/head
Michael Niedermayer 2 years ago
parent 95f0f84dae
commit ac6eec1fc2
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 2
      libavcodec/motionpixels.c

@ -185,7 +185,7 @@ static YuvPixel mp_get_yuv_from_rgb(MotionPixelsContext *mp, int x, int y)
int color;
color = *(uint16_t *)&mp->frame->data[0][y * mp->frame->linesize[0] + x * 2];
return mp_rgb_yuv_table[color];
return mp_rgb_yuv_table[color & 0x7FFF];
}
static void mp_set_rgb_from_yuv(MotionPixelsContext *mp, int x, int y, const YuvPixel *p)

Loading…
Cancel
Save