Browse Source

avcodec/jpeg2000: Check sum of sizes of band->prec before allocating

Fixes: OOM
Fixes: 4810/clusterfuzz-testcase-minimized-6034253235093504

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 6887e41243)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n3.3.7
Michael Niedermayer 7 years ago
parent
commit
488a6ae7e5
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      libavcodec/jpeg2000.c

+ 3
- 0
libavcodec/jpeg2000.c View File

@@ -543,6 +543,9 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
if (!reslevel->band)
return AVERROR(ENOMEM);

if (reslevel->num_precincts_x * (uint64_t)reslevel->num_precincts_y * reslevel->nbands > avctx->max_pixels / sizeof(*reslevel->band->prec))
return AVERROR(ENOMEM);

for (bandno = 0; bandno < reslevel->nbands; bandno++, gbandno++) {
ret = init_band(avctx, reslevel,
comp, codsty, qntsty,


Loading…
Cancel
Save