[FFmpeg-cvslog] swscale: added proper error check for ff_init_filters

Pedro Arthur git at videolan.org
Sat Sep 5 00:00:49 CEST 2015


ffmpeg | branch: master | Pedro Arthur <bygrandao at gmail.com> | Fri Sep  4 18:09:20 2015 -0300| [f67aff3ad7168b0721e7e5ba05858d885966534a] | committer: Pedro Arthur

swscale: added proper error check for ff_init_filters

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

 libswscale/slice.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/libswscale/slice.c b/libswscale/slice.c
index 8fd16d3..4437672 100644
--- a/libswscale/slice.c
+++ b/libswscale/slice.c
@@ -268,7 +268,8 @@ int ff_init_filters(SwsContext * c)
     dstIdx = 1;
 
     if (need_lum_conv) {
-        ff_init_desc_fmt_convert(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx], pal);
+        res = ff_init_desc_fmt_convert(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx], pal);
+        if (res < 0) goto cleanup;
         c->desc[index].alpha = c->alpPixBuf != 0;
         ++index;
         srcIdx = dstIdx;
@@ -276,7 +277,8 @@ int ff_init_filters(SwsContext * c)
 
 
     dstIdx = FFMAX(num_ydesc, num_cdesc);
-    ff_init_desc_hscale(&c->desc[index], &c->slice[index], &c->slice[dstIdx], c->hLumFilter, c->hLumFilterPos, c->hLumFilterSize, c->lumXInc);
+    res = ff_init_desc_hscale(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx], c->hLumFilter, c->hLumFilterPos, c->hLumFilterSize, c->lumXInc);
+    if (res < 0) goto cleanup;
     c->desc[index].alpha = c->alpPixBuf != 0;
 
 
@@ -285,23 +287,26 @@ int ff_init_filters(SwsContext * c)
         srcIdx = 0;
         dstIdx = 1;
         if (need_chr_conv) {
-            ff_init_desc_cfmt_convert(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx], pal);
+            res = ff_init_desc_cfmt_convert(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx], pal);
+            if (res < 0) goto cleanup;
             ++index;
             srcIdx = dstIdx;
         }
 
         dstIdx = FFMAX(num_ydesc, num_cdesc);
         if (c->needs_hcscale)
-            ff_init_desc_chscale(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx], c->hChrFilter, c->hChrFilterPos, c->hChrFilterSize, c->chrXInc);
+            res = ff_init_desc_chscale(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx], c->hChrFilter, c->hChrFilterPos, c->hChrFilterSize, c->chrXInc);
         else
-            ff_init_desc_no_chr(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx]);
+            res = ff_init_desc_no_chr(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx]);
+        if (res < 0) goto cleanup;
     }
 
     ++index;
     {
         srcIdx = c->numSlice - 2;
         dstIdx = c->numSlice - 1;
-        ff_init_vscale(c, c->desc + index, c->slice + srcIdx, c->slice + dstIdx);
+        res = ff_init_vscale(c, c->desc + index, c->slice + srcIdx, c->slice + dstIdx);
+        if (res < 0) goto cleanup;
     }
 
     return 0;



More information about the ffmpeg-cvslog mailing list