[FFmpeg-cvslog] swresample/resample: Limit filter length

Michael Niedermayer git at videolan.org
Sun Jul 20 19:17:03 CEST 2014


ffmpeg | branch: release/1.0 | Michael Niedermayer <michaelni at gmx.at> | Tue Apr  8 00:19:07 2014 +0200| [81e5ce4c280e5ef503b45aebc8916c33021b3222] | committer: Michael Niedermayer

swresample/resample: Limit filter length

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 at gmx.at>
(cherry picked from commit f9158b01d0f3effb58e87fb07db0382bc1e47de5)

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

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

 libswresample/resample.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libswresample/resample.c b/libswresample/resample.c
index 5a82e73..3c77d69 100644
--- a/libswresample/resample.c
+++ b/libswresample/resample.c
@@ -227,6 +227,11 @@ ResampleContext *swri_resample_init(ResampleContext *c, int out_rate, int in_rat
             return NULL;
         }
 
+        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;



More information about the ffmpeg-cvslog mailing list