[FFmpeg-cvslog] lavc: check dimensions for video encoders

Michael Niedermayer git at videolan.org
Fri Dec 7 23:03:09 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Fri Dec  7 22:57:02 2012 +0100| [419ade4b6193c6eb626cda01b21e7091f42b2cc2] | committer: Michael Niedermayer

lavc: check dimensions for video encoders

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/utils.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d042afa..3d33f85 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1000,6 +1000,13 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
         } else if (avctx->channel_layout) {
             avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout);
         }
+        if(avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
+            if (avctx->width <= 0 || avctx->height <= 0) {
+                av_log(avctx, AV_LOG_ERROR, "dimensions not set\n");
+                ret = AVERROR(EINVAL);
+                goto free_and_end;
+            }
+        }
     }
 
     avctx->pts_correction_num_faulty_pts =



More information about the ffmpeg-cvslog mailing list