[FFmpeg-cvslog] avcodec/hcom: check that index into array is valid

Paul B Mahol git at videolan.org
Sun Mar 3 21:22:53 EET 2019


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Mar  3 20:21:20 2019 +0100| [17008a010753833dadd0ff8442b11046da4cd638] | committer: Paul B Mahol

avcodec/hcom: check that index into array is valid

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=17008a010753833dadd0ff8442b11046da4cd638
---

 libavcodec/hcom.c | 4 ++++
 1 file changed, 4 insertions(+)

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;



More information about the ffmpeg-cvslog mailing list