Browse Source

avfilter/vf_premultiply: fix signed integer overflow

Fixes #8324
tags/n4.3
Paul B Mahol 5 years ago
parent
commit
5561a1de90
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      libavfilter/vf_premultiply.c

+ 2
- 2
libavfilter/vf_premultiply.c View File

@@ -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;


Loading…
Cancel
Save