avcodec/vqcdec: Check width & 15

Various parts of the code assume that width can be divided by various powers of 2
without rounding

Fixes: out of array access
Fixes: 53623/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQC_fuzzer-6209269924233216

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
pull/388/head
Michael Niedermayer 2 years ago
parent 2401494e96
commit a9d15d43eb
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 3
      libavcodec/vqcdec.c

@ -71,6 +71,9 @@ static av_cold int vqc_decode_init(AVCodecContext * avctx)
static AVOnce init_static_once = AV_ONCE_INIT; static AVOnce init_static_once = AV_ONCE_INIT;
VqcContext *s = avctx->priv_data; VqcContext *s = avctx->priv_data;
if (avctx->width & 15)
return AVERROR_PATCHWELCOME;
s->vectors = av_malloc((avctx->width * avctx->height * 3) / 2); s->vectors = av_malloc((avctx->width * avctx->height * 3) / 2);
if (!s->vectors) if (!s->vectors)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);

Loading…
Cancel
Save