[FFmpeg-cvslog] avfilter/vf_premultiply: fix signed integer overflow

Paul B Mahol git at videolan.org
Tue Oct 22 11:40:07 EEST 2019


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Oct 22 10:38:16 2019 +0200| [5561a1de90cd3f80ab9ec543f28b6e96a9d0a86c] | committer: Paul B Mahol

avfilter/vf_premultiply: fix signed integer overflow

Fixes #8324

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

 libavfilter/vf_premultiply.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c
index 5338af742c..60830e7e84 100644
--- a/libavfilter/vf_premultiply.c
+++ b/libavfilter/vf_premultiply.c
@@ -186,7 +186,7 @@ static void premultiply16yuv(const uint8_t *mmsrc, const uint8_t *aasrc,
 
     for (y = 0; y < h; y++) {
         for (x = 0; x < w; x++) {
-            dst[x] = ((((msrc[x] - half) * (((asrc[x] >> 1) & 1) + asrc[x]))) >> shift) + half;
+            dst[x] = ((((msrc[x] - half) * (int64_t)(((asrc[x] >> 1) & 1) + asrc[x]))) >> shift) + half;
         }
 
         dst  += dlinesize / 2;
@@ -209,7 +209,7 @@ static void premultiply16offset(const uint8_t *mmsrc, const uint8_t *aasrc,
 
     for (y = 0; y < h; y++) {
         for (x = 0; x < w; x++) {
-            dst[x] = ((((msrc[x] - offset) * (((asrc[x] >> 1) & 1) + asrc[x])) + half) >> shift) + offset;
+            dst[x] = ((((msrc[x] - offset) * (int64_t)(((asrc[x] >> 1) & 1) + asrc[x])) + half) >> shift) + offset;
         }
 
         dst  += dlinesize / 2;



More information about the ffmpeg-cvslog mailing list