[FFmpeg-devel] [PATCH 1/2] swresample/resample_template: flip order of operations in swri_resample_linear() for 32bit

Michael Niedermayer michaelni at gmx.at
Sun Jun 29 14:53:36 CEST 2014


Fixes integer overflow

Found-by: BBB
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libswresample/resample_template.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libswresample/resample_template.c b/libswresample/resample_template.c
index db208e3..3d566d0 100644
--- a/libswresample/resample_template.c
+++ b/libswresample/resample_template.c
@@ -174,7 +174,11 @@ int RENAME(swri_resample_linear)(ResampleContext *c,
             v2  += src[sample_index + i] * (FELEM2)filter[i + c->filter_alloc];
         }
 #endif
+#ifdef FELEML
         val += (v2 - val) * (FELEML) frac / c->src_incr;
+#else
+        val += (v2 - val) / c->src_incr * frac;
+#endif
         OUT(dst[dst_index], val);
 
         frac += c->dst_incr_mod;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list