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");
return AVERROR_PATCHWELCOME;
}
+ if (s->tile_offset_x < 0 || s->tile_offset_y < 0 ||
+ s->image_offset_x < s->tile_offset_x ||
+ s->image_offset_y < s->tile_offset_y ||
+ s->tile_width + (int64_t)s->tile_offset_x <= s->image_offset_x ||
+ s->tile_height + (int64_t)s->tile_offset_y <= s->image_offset_y
+ ) {
+ av_log(s->avctx, AV_LOG_ERROR, "Tile offsets are invalid\n");
+ return AVERROR_INVALIDDATA;
+ }
+
s->ncomponents = ncomponents;
if (s->tile_width <= 0 || s->tile_height <= 0) {
}
/* 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) {