[FFmpeg-cvslog] swscale/utils: dont divide by zero with zero vectors

Michael Niedermayer git at videolan.org
Tue Oct 1 00:38:26 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Oct  1 00:27:28 2013 +0200| [2e2a2d8801b045b3dd58a4e49e8e040b559bc84a] | committer: Michael Niedermayer

swscale/utils: dont divide by zero with zero vectors

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

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

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

diff --git a/libswscale/utils.c b/libswscale/utils.c
index 05ab0c6..a2e3ce1 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -622,6 +622,10 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
             sum += filter[i * filterSize + j];
         }
         sum = (sum + one / 2) / one;
+        if (!sum) {
+            av_log(NULL, AV_LOG_WARNING, "SwScaler: zero vector in scaling\n");
+            sum = 1;
+        }
         for (j = 0; j < *outFilterSize; j++) {
             int64_t v = filter[i * filterSize + j] + error;
             int intV  = ROUNDED_DIV(v, sum);



More information about the ffmpeg-cvslog mailing list