[FFmpeg-cvslog] get_buffers: Check that pix_fmt is not NONE.

Michael Niedermayer git at videolan.org
Wed Feb 29 06:41:51 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Feb 29 06:20:22 2012 +0100| [c2500635235d809e0c0ac526a7e13072ab7c8900] | committer: Michael Niedermayer

get_buffers: Check that pix_fmt is not NONE.

This is somewhat redundant as no decoder should call get_buffer() with such argument.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c2500635235d809e0c0ac526a7e13072ab7c8900
---

 ffmpeg.c           |    2 +-
 ffplay.c           |    2 +-
 libavcodec/utils.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 06fb253..c43192d 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -553,7 +553,7 @@ static int codec_get_buffer(AVCodecContext *s, AVFrame *frame)
     FrameBuffer *buf;
     int ret, i;
 
-    if(av_image_check_size(s->width, s->height, 0, s))
+    if(av_image_check_size(s->width, s->height, 0, s) || s->pix_fmt<0)
         return -1;
 
     if (!ist->buffer_pool && (ret = alloc_buffer(s, ist, &ist->buffer_pool)) < 0)
diff --git a/ffplay.c b/ffplay.c
index 19c4308..93097e1 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1564,7 +1564,7 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
     w = codec->width;
     h = codec->height;
 
-    if(av_image_check_size(w, h, 0, codec))
+    if(av_image_check_size(w, h, 0, codec) || codec->pix_fmt<0)
         return -1;
 
     avcodec_align_dimensions2(codec, &w, &h, stride);
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index a697fac..63f7fae 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -414,7 +414,7 @@ static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
         return -1;
     }
 
-    if(av_image_check_size(w, h, 0, s))
+    if(av_image_check_size(w, h, 0, s) || s->pix_fmt<0)
         return -1;
 
     if (!avci->buffer) {



More information about the ffmpeg-cvslog mailing list