summaryrefslogtreecommitdiff
path: root/libavcodec/lscrdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2021-03-30 13:17:09 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-04-01 10:10:21 +0200
commitc01cd2a8b2a67da975d51fdf03f18c502df2e13c (patch)
tree1654521b2ca428bf7d78e2639788cdce4990fbb4 /libavcodec/lscrdec.c
parent6055b93379fd29477afa8f24881223a14e2f6b81 (diff)
downloadffmpeg-c01cd2a8b2a67da975d51fdf03f18c502df2e13c.tar.gz
avcodec/lscrdec: Check length in decode_idat()
Fixes: out of array access Fixes: 32264/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LSCR_fuzzer-6684504010915840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/lscrdec.c')
-rw-r--r--libavcodec/lscrdec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/lscrdec.c b/libavcodec/lscrdec.c
index f5cfe1fa04..042da84bf9 100644
--- a/libavcodec/lscrdec.c
+++ b/libavcodec/lscrdec.c
@@ -76,6 +76,10 @@ static int decode_idat(LSCRContext *s, int length)
int ret;
s->zstream.avail_in = FFMIN(length, bytestream2_get_bytes_left(&s->gb));
s->zstream.next_in = s->gb.buffer;
+
+ if (length <= 0)
+ return AVERROR_INVALIDDATA;
+
bytestream2_skip(&s->gb, length);
/* decode one line if possible */