summaryrefslogtreecommitdiff
path: root/libavcodec/hcom.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-09-25 18:38:03 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-09-26 21:02:34 +0200
commitb2785cd3ac05388b769bc68c083aa4770c632c3e (patch)
tree076b9a9036133100b35f4c84a38c48c3fa54f057 /libavcodec/hcom.c
parentcfa193779103c97bbfc28273a0ab12c114b6786d (diff)
downloadffmpeg-b2785cd3ac05388b769bc68c083aa4770c632c3e.tar.gz
avcodec/hcom: Check that there are dictionary entries
Fixes: out of array read Fixes: 17617/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCOM_fuzzer-5674970478280704 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/hcom.c')
-rw-r--r--libavcodec/hcom.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/hcom.c b/libavcodec/hcom.c
index bce9e80aa5..0559b050c3 100644
--- a/libavcodec/hcom.c
+++ b/libavcodec/hcom.c
@@ -52,7 +52,8 @@ static av_cold int hcom_init(AVCodecContext *avctx)
if (avctx->extradata_size <= 7)
return AVERROR_INVALIDDATA;
s->dict_entries = AV_RB16(avctx->extradata);
- if (avctx->extradata_size < s->dict_entries * 4 + 7)
+ if (avctx->extradata_size < s->dict_entries * 4 + 7 ||
+ s->dict_entries == 0)
return AVERROR_INVALIDDATA;
s->delta_compression = AV_RB32(avctx->extradata + 2);
s->sample = s->first_sample = avctx->extradata[avctx->extradata_size - 1];