mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-08-13 17:07:21 +00:00
avcodec/jpeg2000htdec: Check Lcup and Lref
Fixes: use of uninitialized memory
Fixes: 482494999/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_JPEG2000_DEC_fuzzer-6467586186608640
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 99515a3342)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -1226,6 +1226,11 @@ ff_jpeg2000_decode_htj2k(const Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c
|
||||
"Cleanup pass length must be at least 2 bytes in length\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
// this might arise either if the codestream is corrupted; or contains multiple HT Sets
|
||||
// (see Rec. ITU-T T.814, Annex B.1), which the parser does not currently support
|
||||
if (Lcup + Lref != cblk->length)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
Dcup = cblk->data;
|
||||
Dref = cblk->data + Lcup; // Dref comes after the refinement segment
|
||||
S_blk = p0 + cblk->zbp;
|
||||
|
||||
Reference in New Issue
Block a user