Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2017-11-30 23:51:56 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2017-12-02 01:12:07 +0300
commitb5587fd2c6ce39bad7a5e7ebb3bd86b6469648de (patch)
tree67609c94bb610354ab76aadb906f62cde6049535 /libavcodec/j2kenc.c
parent0674087004538599797688785f6ac82358abc23b (diff)
avcodec/jpeg2000: Only allocate Jpeg2000Pass for the encoder
Reduces memory needed. Fixes: OOM Fixes: 4427/clusterfuzz-testcase-minimized-5106919271301120 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/j2kenc.c')
-rw-r--r--libavcodec/j2kenc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index 78ec88a694..3e542af3c6 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -941,7 +941,9 @@ static int encode_tile(Jpeg2000EncoderContext *s, Jpeg2000Tile *tile, int tileno
}
if (!prec->cblk[cblkno].data)
prec->cblk[cblkno].data = av_malloc(1 + 8192);
- if (!prec->cblk[cblkno].data)
+ if (!prec->cblk[cblkno].passes)
+ prec->cblk[cblkno].passes = av_malloc_array(JPEG2000_MAX_PASSES, sizeof (*prec->cblk[cblkno].passes));
+ if (!prec->cblk[cblkno].data || !prec->cblk[cblkno].passes)
return AVERROR(ENOMEM);
encode_cblk(s, &t1, prec->cblk + cblkno, tile, xx1 - xx0, yy1 - yy0,
bandpos, codsty->nreslevels - reslevelno - 1);