aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2019-03-03 20:21:20 +0100
committerPaul B Mahol <onemda@gmail.com>2019-03-03 20:21:20 +0100
commit17008a010753833dadd0ff8442b11046da4cd638 (patch)
tree4eb6e429313d6313ad72b5c53e6d78b78bcf4c20
parenta367a932d36ac9be0150d08f6e043eebae6d6a7a (diff)
downloadffmpeg-17008a010753833dadd0ff8442b11046da4cd638.tar.gz
avcodec/hcom: check that index into array is valid
-rw-r--r--libavcodec/hcom.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/hcom.c b/libavcodec/hcom.c
index 8753486c02..bce9e80aa5 100644
--- a/libavcodec/hcom.c
+++ b/libavcodec/hcom.c
@@ -63,6 +63,10 @@ static av_cold int hcom_init(AVCodecContext *avctx)
for (int i = 0; i < s->dict_entries; i++) {
s->dict[i].l = AV_RB16(avctx->extradata + 6 + 4 * i);
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))
+ return AVERROR_INVALIDDATA;
}
avctx->sample_fmt = AV_SAMPLE_FMT_U8;