Commit a1a8cbcb authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/jpeg2000: Check comp coords to be within the supported size

Fixes assertion failure
Fixes: 03e0abe721b1174856d41a1eb5d6a896/signal_sigabrt_7ffff6ae7cc9_3813_e71bf3541abed3ccba031cd5ba0269a4.avi

This fix is choosen to be simple to backport, better solution
for master is planed

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 016fd413
...@@ -468,6 +468,11 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp, ...@@ -468,6 +468,11 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
csize = (comp->coord[0][1] - comp->coord[0][0]) * csize = (comp->coord[0][1] - comp->coord[0][0]) *
(comp->coord[1][1] - comp->coord[1][0]); (comp->coord[1][1] - comp->coord[1][0]);
if (comp->coord[0][1] > 32768 ||
comp->coord[1][1] > 32768) {
av_log(avctx, AV_LOG_ERROR, "component size too large\n");
return AVERROR_PATCHWELCOME;
}
if (codsty->transform == FF_DWT97) { if (codsty->transform == FF_DWT97) {
csize += AV_INPUT_BUFFER_PADDING_SIZE / sizeof(*comp->f_data); csize += AV_INPUT_BUFFER_PADDING_SIZE / sizeof(*comp->f_data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment