- if (st->codecpar->width * 4LL * st->codecpar->height >= INT_MAX) {
- av_log(s, AV_LOG_ERROR, "dimensions too large\n");
- return AVERROR_PATCHWELCOME;
- }
+ if (av_image_check_size(st->codecpar->width, st->codecpar->height, 0, s) < 0)
+ return AVERROR_INVALIDDATA;