#define BITSTREAM_READER_LE
#include "avcodec.h"
#include "get_bits.h"
+#include "libavutil/imgutils.h"
#include "indeo4data.h"
#include "internal.h"
#include "ivi.h"
pic_conf.chroma_bands = 0;
if (pic_conf.luma_bands)
pic_conf.chroma_bands = decode_plane_subdivision(&ctx->gb);
+
+ if (av_image_check_size2(pic_conf.pic_width, pic_conf.pic_height, avctx->max_pixels, AV_PIX_FMT_YUV410P, 0, avctx) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "picture dimensions %d %d cannot be decoded\n",
+ pic_conf.pic_width, pic_conf.pic_height);
+ return AVERROR_INVALIDDATA;
+ }
+
ctx->is_scalable = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1;
if (ctx->is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) {
av_log(avctx, AV_LOG_ERROR, "Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n",
mb->b_mv_x =
mb->b_mv_y = 0;
+ if (get_bits_left(&ctx->gb) < 1) {
+ av_log(avctx, AV_LOG_ERROR, "Insufficient input for mb info\n");
+ return AVERROR_INVALIDDATA;
+ }
+
if (get_bits1(&ctx->gb)) {
if (ctx->frame_type == IVI4_FRAMETYPE_INTRA) {
av_log(avctx, AV_LOG_ERROR, "Empty macroblock in an INTRA picture!\n");