aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/hcom.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-10-07 16:56:11 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2019-12-31 19:51:56 +0100
commit28ddc0b9b85d3aa5a3b78967eb78dfc84ef6942d (patch)
tree8c07954e63119abc9992c34ef11a71b5fdc267f0 /libavcodec/hcom.c
parentf66e52fd964e87e3abe0e01c8511c808ec18f363 (diff)
downloadffmpeg-28ddc0b9b85d3aa5a3b78967eb78dfc84ef6942d.tar.gz
avcodec/hcom: Check the root entry and the right entries
Fixes: Segfault Fixes: 17991/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HCOM_fuzzer-5647235349479424 Also fixes related memleak Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 4834ec926aa569cf25c797e22643d4735880b7a1) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/hcom.c')
-rw-r--r--libavcodec/hcom.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/hcom.c b/libavcodec/hcom.c
index 0559b050c3..8300676f98 100644
--- a/libavcodec/hcom.c
+++ b/libavcodec/hcom.c
@@ -66,8 +66,15 @@ static av_cold int hcom_init(AVCodecContext *avctx)
s->dict[i].r = AV_RB16(avctx->extradata + 6 + 4 * i + 2);
if (s->dict[i].l >= 0 &&
(s->dict[i].l >= s->dict_entries ||
- s->dict[i].r >= s->dict_entries))
+ s->dict[i].r >= s->dict_entries ||
+ s->dict[i].r < 0 )) {
+ av_freep(&s->dict);
return AVERROR_INVALIDDATA;
+ }
+ }
+ if (s->dict[0].l < 0) {
+ av_freep(&s->dict);
+ return AVERROR_INVALIDDATA;
}
avctx->sample_fmt = AV_SAMPLE_FMT_U8;