avcodec/jpeg2000: Check that codsty->log2_prec_widths/heights has been initialized

Fixes: OOM
Fixes: 2225/clusterfuzz-testcase-minimized-5505632079708160

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 64e034da95)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2017-09-04 22:23:26 +02:00
parent f1a272b7b4
commit 4b4c7935da
1 changed files with 3 additions and 0 deletions

View File

@ -252,6 +252,9 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
// update precincts size: 2^n value
reslevel->log2_prec_width = codsty->log2_prec_widths[reslevelno];
reslevel->log2_prec_height = codsty->log2_prec_heights[reslevelno];
if (!reslevel->log2_prec_width || !reslevel->log2_prec_height) {
return AVERROR_INVALIDDATA;
}
/* Number of bands for each resolution level */
if (reslevelno == 0)