]> git.sesse.net Git - ffmpeg/blobdiff - libswresample/resample.c
avcodec/mpeg12dec: drop confusing av_dlog()
[ffmpeg] / libswresample / resample.c
index 581382faa69dea0777cfc9a2c61aa4c838193cf6..ac87671902b775d288930367d6beff4b585643f2 100644 (file)
@@ -95,7 +95,7 @@ static int build_filter(ResampleContext *c, void *filter, double factor, int tap
                         int filter_type, int kaiser_beta){
     int ph, i;
     double x, y, w;
-    double *tab = av_malloc(tap_count * sizeof(*tab));
+    double *tab = av_malloc_array(tap_count,  sizeof(*tab));
     const int center= (tap_count-1)/2;
 
     if (!tab)
@@ -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;