[FFmpeg-cvslog] avcodec/jpeg2000dec: Use ff_set_dimensions()
Michael Niedermayer
git at videolan.org
Sun Jun 18 17:30:32 EEST 2017
ffmpeg | branch: release/3.1 | Michael Niedermayer <michael at niedermayer.cc> | Mon May 29 13:45:29 2017 +0200| [4ba6f68b27c2668943982d04c8bc624504c8375b] | committer: Michael Niedermayer
avcodec/jpeg2000dec: Use ff_set_dimensions()
Fixes: OOM
Fixes: 1890/clusterfuzz-testcase-minimized-6329019509243904
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit f3da6fbff864e05e8871dd04222143abdee9e77b)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ba6f68b27c2668943982d04c8bc624504c8375b
---
libavcodec/jpeg2000dec.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 6267629fad..b23e1678d5 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -260,6 +260,7 @@ static int get_siz(Jpeg2000DecoderContext *s)
uint32_t log2_chroma_wh = 0;
const enum AVPixelFormat *possible_fmts = NULL;
int possible_fmts_nb = 0;
+ int ret;
if (bytestream2_get_bytes_left(&s->g) < 36) {
av_log(s->avctx, AV_LOG_ERROR, "Insufficient space for SIZ\n");
@@ -359,10 +360,13 @@ static int get_siz(Jpeg2000DecoderContext *s)
}
/* compute image size with reduction factor */
- s->avctx->width = ff_jpeg2000_ceildivpow2(s->width - s->image_offset_x,
- s->reduction_factor);
- s->avctx->height = ff_jpeg2000_ceildivpow2(s->height - s->image_offset_y,
- s->reduction_factor);
+ ret = ff_set_dimensions(s->avctx,
+ ff_jpeg2000_ceildivpow2(s->width - s->image_offset_x,
+ s->reduction_factor),
+ ff_jpeg2000_ceildivpow2(s->height - s->image_offset_y,
+ s->reduction_factor));
+ if (ret < 0)
+ return ret;
if (s->avctx->profile == FF_PROFILE_JPEG2000_DCINEMA_2K ||
s->avctx->profile == FF_PROFILE_JPEG2000_DCINEMA_4K) {
More information about the ffmpeg-cvslog
mailing list