[FFmpeg-cvslog] swscale/utils: add asserts to check filterpos

Michael Niedermayer git at videolan.org
Tue Feb 24 01:09:43 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Feb 24 00:35:11 2015 +0100| [fb8e5044b420d4f7409a3bf2cc5498e8302882be] | committer: Michael Niedermayer

swscale/utils: add asserts to check filterpos

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

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

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

diff --git a/libswscale/utils.c b/libswscale/utils.c
index b63ab19..cfa6b21 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -631,6 +631,13 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
             (*filterPos)[i]-= shift;
             filter[i * filterSize + srcW - 1 - (*filterPos)[i]] += acc;
         }
+        av_assert0((*filterPos)[i] >= 0);
+        av_assert0((*filterPos)[i] < srcW);
+        if ((*filterPos)[i] + filterSize > srcW) {
+            for (j = 0; j < filterSize; j++) {
+                av_assert0((*filterPos)[i] + j < srcW || !filter[i * filterSize + j]);
+            }
+        }
     }
 
     // Note the +1 is for the MMX scaler which reads over the end



More information about the ffmpeg-cvslog mailing list