]> git.sesse.net Git - ffmpeg/commitdiff
swresample/resample: Limit filter length
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 7 Apr 2014 22:19:07 +0000 (00:19 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 7 Apr 2014 22:25:49 +0000 (00:25 +0200)
Related to CID1197063

The limit choosen is arbitrary and much larger than what makes sense.
It avoids the need for checking arithmetic operations with the length for overflow

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libswresample/resample.c

index 581382faa69dea0777cfc9a2c61aa4c838193cf6..77653a7a9fb08126b5c61312feeaa29f4e0dd1a6 100644 (file)
@@ -229,6 +229,11 @@ static ResampleContext *resample_init(ResampleContext *c, int out_rate, int in_r
             av_assert0(0);
         }
 
+        if (filter_size/factor > INT32_MAX/256) {
+            av_log(NULL, AV_LOG_ERROR, "Filter length too large\n");
+            goto error;
+        }
+
         c->phase_shift   = phase_shift;
         c->phase_mask    = phase_count - 1;
         c->linear        = linear;