[FFmpeg-cvslog] avfilter/vf_format: Check pix_fmts before dereferencing it

Michael Niedermayer git at videolan.org
Thu Jul 3 02:43:17 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Jul  3 02:05:34 2014 +0200| [126524720661a9adddec758e94729007a96f07f7] | committer: Michael Niedermayer

avfilter/vf_format: Check pix_fmts before dereferencing it

Fixes CID1224286

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

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

 libavfilter/vf_format.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c
index afa17fe..13b41e4 100644
--- a/libavfilter/vf_format.c
+++ b/libavfilter/vf_format.c
@@ -60,6 +60,9 @@ static av_cold int init(AVFilterContext *ctx)
     int i;
     int ret;
 
+    if (!s->pix_fmts)
+        return AVERROR(EINVAL);
+
     /* count the formats */
     cur = s->pix_fmts;
     while ((cur = strchr(cur, '|'))) {
@@ -72,9 +75,6 @@ static av_cold int init(AVFilterContext *ctx)
     if (!s->formats)
         return AVERROR(ENOMEM);
 
-    if (!s->pix_fmts)
-        return AVERROR(EINVAL);
-
     /* parse the list of formats */
     cur = s->pix_fmts;
     for (i = 0; i < nb_formats; i++) {



More information about the ffmpeg-cvslog mailing list