diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-03-07 15:42:58 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-03-12 00:14:10 +0100 |
commit | 1812352d767ccf5431aa440123e2e260a4db2726 (patch) | |
tree | 6e82707c085520cac247a3e4a4c2fa9eb70db9a7 /libavcodec/cbs_jpeg.c | |
parent | 0a11ef68f0a85905e704e503b433f5aa645d59ac (diff) | |
download | ffmpeg-1812352d767ccf5431aa440123e2e260a4db2726.tar.gz |
avcodec/cbs_jpeg: Check length for SOS
Fixes: out of array access
Fixes: 19734/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5673507031875584
Fixes: 19353/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5703944462663680
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/cbs_jpeg.c')
-rw-r--r-- | libavcodec/cbs_jpeg.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/cbs_jpeg.c b/libavcodec/cbs_jpeg.c index 6bbce5f89b..89512a26bb 100644 --- a/libavcodec/cbs_jpeg.c +++ b/libavcodec/cbs_jpeg.c @@ -197,6 +197,9 @@ static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx, if (marker == JPEG_MARKER_SOS) { length = AV_RB16(frag->data + start); + if (length > end - start) + return AVERROR_INVALIDDATA; + data_ref = NULL; data = av_malloc(end - start + AV_INPUT_BUFFER_PADDING_SIZE); |