diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c index a373df7d35..d9918f48b9 100644 --- a/libavcodec/sunrast.c +++ b/libavcodec/sunrast.c @@ -61,10 +61,6 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data, av_log(avctx, AV_LOG_ERROR, "invalid (compression) type\n"); return AVERROR_INVALIDDATA; } - if (av_image_check_size(w, h, 0, avctx)) { - av_log(avctx, AV_LOG_ERROR, "invalid image size\n"); - return AVERROR_INVALIDDATA; - } if (maptype == RMT_RAW) { avpriv_request_sample(avctx, "Unknown colormap type"); return AVERROR_PATCHWELCOME; @@ -100,8 +96,10 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } - if (w != avctx->width || h != avctx->height) - avcodec_set_dimensions(avctx, w, h); + ret = ff_set_dimensions(avctx, w, h); + if (ret < 0) + return ret; + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c index 6c8bfc4e48..d62524dcae 100644 --- a/libavcodec/svq1dec.c +++ b/libavcodec/svq1dec.c @@ -638,7 +638,10 @@ static int svq1_decode_frame(AVCodecContext *avctx, void *data, av_dlog(avctx, "Error in svq1_decode_frame_header %i\n", result); return result; } - avcodec_set_dimensions(avctx, s->width, s->height); + + result = ff_set_dimensions(avctx, s->width, s->height); + if (result < 0) + return result; if ((avctx->skip_frame >= AVDISCARD_NONREF && s->nonref) || (avctx->skip_frame >= AVDISCARD_NONKEY && diff --git a/libavcodec/targa.c b/libavcodec/targa.c index b3616c29d7..b0c9b55f33 100644 --- a/libavcodec/targa.c +++ b/libavcodec/targa.c @@ -173,10 +173,9 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } - if ((ret = av_image_check_size(w, h, 0, avctx)) < 0) + if ((ret = ff_set_dimensions(avctx, w, h)) < 0) return ret; - if (w != avctx->width || h != avctx->height) - avcodec_set_dimensions(avctx, w, h); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; p->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 2b100ede5e..cd209674ca 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -546,9 +546,9 @@ static int init_image(TiffContext *s, ThreadFrame *frame) return AVERROR_INVALIDDATA; } if (s->width != s->avctx->width || s->height != s->avctx->height) { - if ((ret = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0) + ret = ff_set_dimensions(s->avctx, s->width, s->height); + if (ret < 0) return ret; - avcodec_set_dimensions(s->avctx, s->width, s->height); } if ((ret = ff_thread_get_buffer(s->avctx, frame, 0)) < 0) return ret;