summaryrefslogtreecommitdiff
path: root/libavcodec/avrndec.c
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2012-11-25 13:20:19 +1100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-25 18:38:12 +0100
commita246a603bf8195d09e81aa6a0d9f1bdd361ae700 (patch)
treee7e414c69579a1f568d352213b7c397b9b6064b4 /libavcodec/avrndec.c
parent2d954ccd84e6a3dd030325ef94afec67309b2eba (diff)
downloadffmpeg-a246a603bf8195d09e81aa6a0d9f1bdd361ae700.tar.gz
avrndec: use av_image_check_size
Signed-off-by: Peter Ross <pross@xvid.org> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/avrndec.c')
-rw-r--r--libavcodec/avrndec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/avrndec.c b/libavcodec/avrndec.c
index 2fa369cb63..2205a422e2 100644
--- a/libavcodec/avrndec.c
+++ b/libavcodec/avrndec.c
@@ -22,6 +22,7 @@
#include "avcodec.h"
#include "mjpeg.h"
#include "mjpegdec.h"
+#include "libavutil/imgutils.h"
typedef struct {
MJpegDecodeContext mjpeg_ctx;
@@ -34,6 +35,7 @@ typedef struct {
static av_cold int init(AVCodecContext *avctx)
{
AVRnContext *a = avctx->priv_data;
+ int ret;
// Support "Resolution 1:1" for Avid AVI Codec
a->is_mjpeg = avctx->extradata_size < 31 || memcmp(&avctx->extradata[28], "1:1", 3);
@@ -46,8 +48,8 @@ static av_cold int init(AVCodecContext *avctx)
if(a->is_mjpeg)
return ff_mjpeg_decode_init(avctx);
- if(avctx->width <= 0 || avctx->height <= 0)
- return AVERROR_INVALIDDATA;
+ if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
+ return ret;
avcodec_get_frame_defaults(&a->frame);
avctx->pix_fmt = AV_PIX_FMT_UYVY422;