diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2017-12-17 18:29:45 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2017-12-21 19:48:41 +0100 |
commit | 42274db1c623d2c0acd616cc0d3a0e5489e3bdb2 (patch) | |
tree | 1f6cfebde5da75dc9a70287f159cddbb6ad080ee /libavcodec/jpeg2000.c | |
parent | 1083859cb8c9d9b3bcee970dd33b71015a0a11bc (diff) | |
download | ffmpeg-42274db1c623d2c0acd616cc0d3a0e5489e3bdb2.tar.gz |
avcodec/jpeg2000dec: Allocate lengthinc and data_start arrays as needed
Decreases memory requirements
Fixes: OOM
Fixes: 4525/clusterfuzz-testcase-minimized-6400713073623040
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/jpeg2000.c')
-rw-r--r-- | libavcodec/jpeg2000.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c index 5f3965047f..e7f03bd0df 100644 --- a/libavcodec/jpeg2000.c +++ b/libavcodec/jpeg2000.c @@ -359,7 +359,6 @@ static int init_prec(Jpeg2000Band *band, cblk->lblock = 3; cblk->length = 0; - memset(cblk->lengthinc, 0, sizeof(cblk->lengthinc)); cblk->npasses = 0; } @@ -607,6 +606,8 @@ void ff_jpeg2000_cleanup(Jpeg2000Component *comp, Jpeg2000CodingStyle *codsty) Jpeg2000Cblk *cblk = &prec->cblk[cblkno]; av_freep(&cblk->data); av_freep(&cblk->passes); + av_freep(&cblk->lengthinc); + av_freep(&cblk->data_start); } av_freep(&prec->cblk); } |