[FFmpeg-cvslog] avfilter/asrc_sine: Fix invalid left shift of negative number

Andreas Rheinhardt git at videolan.org
Sun Mar 28 20:08:46 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Wed Jan 22 02:05:10 2020 +0100| [55b46902c1f855d02ea802de1285d68577a38806] | committer: Andreas Rheinhardt

avfilter/asrc_sine: Fix invalid left shift of negative number

by using a multiplication instead. The multiplication can never overflow
an int because the sin-factor is only an int16_t.

Affected the FATE-tests filter-concat and filter-concat-vfr.

Reviewed-by: Nicolas George <george at nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

 libavfilter/asrc_sine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavfilter/asrc_sine.c b/libavfilter/asrc_sine.c
index 6fe080efb6..3b7d2e6d00 100644
--- a/libavfilter/asrc_sine.c
+++ b/libavfilter/asrc_sine.c
@@ -247,7 +247,7 @@ static int request_frame(AVFilterLink *outlink)
         samples[i] = sine->sin[sine->phi >> (32 - LOG_PERIOD)];
         sine->phi += sine->dphi;
         if (sine->beep_index < sine->beep_length) {
-            samples[i] += sine->sin[sine->phi_beep >> (32 - LOG_PERIOD)] << 1;
+            samples[i] += sine->sin[sine->phi_beep >> (32 - LOG_PERIOD)] * 2;
             sine->phi_beep += sine->dphi_beep;
         }
         if (++sine->beep_index == sine->beep_period)



More information about the ffmpeg-cvslog mailing list