[FFmpeg-devel] [PATCH 3/4] avrndec: use av_image_check_size
Peter Ross
pross at xvid.org
Sun Nov 25 03:20:19 CET 2012
Signed-off-by: Peter Ross <pross at xvid.org>
---
libavcodec/avrndec.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libavcodec/avrndec.c b/libavcodec/avrndec.c
index 2fa369c..2205a42 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;
--
1.8.0
-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121125/177a2af2/attachment.asc>
More information about the ffmpeg-devel
mailing list