summaryrefslogtreecommitdiff
path: root/libswscale/output.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-01-14 18:36:02 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-01-14 21:58:02 +0100
commitb99f4987167946872bd7987164445b4d20f35c33 (patch)
treec1e3d040743e9f146d17757734ddf34090cf71a1 /libswscale/output.c
parentfe6372bb614db1a8d73514d045c7c7b0b059289a (diff)
swscale/output: Assert that yalpha and uvalpha are within their expected range
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libswscale/output.c')
-rw-r--r--libswscale/output.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libswscale/output.c b/libswscale/output.c
index 4b70626b83..58118141aa 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -385,6 +385,7 @@ yuv2mono_2_c_template(SwsContext *c, const int16_t *buf[2],
const uint8_t * const d128 = ff_dither_8x8_220[y & 7];
int yalpha1 = 4096 - yalpha;
int i;
+ av_assert2(yalpha <= 4096U);
if (c->dither == SWS_DITHER_ED) {
int err = 0;
@@ -590,6 +591,8 @@ yuv2422_2_c_template(SwsContext *c, const int16_t *buf[2],
int yalpha1 = 4096 - yalpha;
int uvalpha1 = 4096 - uvalpha;
int i;
+ av_assert2(yalpha <= 4096U);
+ av_assert2(uvalpha <= 4096U);
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19;
@@ -777,6 +780,9 @@ yuv2rgba64_2_c_template(SwsContext *c, const int32_t *buf[2],
int i;
int A1 = 0xffff<<14, A2 = 0xffff<<14;
+ av_assert2(yalpha <= 4096U);
+ av_assert2(uvalpha <= 4096U);
+
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14;
int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14;
@@ -1006,6 +1012,9 @@ yuv2rgba64_full_2_c_template(SwsContext *c, const int32_t *buf[2],
int i;
int A = 0xffff<<14;
+ av_assert2(yalpha <= 4096U);
+ av_assert2(uvalpha <= 4096U);
+
for (i = 0; i < dstW; i++) {
int Y = (buf0[i] * yalpha1 + buf1[i] * yalpha) >> 14;
int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha - (128 << 23)) >> 14;
@@ -1387,6 +1396,8 @@ yuv2rgb_2_c_template(SwsContext *c, const int16_t *buf[2],
int yalpha1 = 4096 - yalpha;
int uvalpha1 = 4096 - uvalpha;
int i;
+ av_assert2(yalpha <= 4096U);
+ av_assert2(uvalpha <= 4096U);
for (i = 0; i < ((dstW + 1) >> 1); i++) {
int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 19;
@@ -1729,6 +1740,9 @@ yuv2rgb_full_2_c_template(SwsContext *c, const int16_t *buf[2],
int err[4] = {0};
int A = 0; // init to silcene warning
+ av_assert2(yalpha <= 4096U);
+ av_assert2(uvalpha <= 4096U);
+
if( target == AV_PIX_FMT_BGR4_BYTE || target == AV_PIX_FMT_RGB4_BYTE
|| target == AV_PIX_FMT_BGR8 || target == AV_PIX_FMT_RGB8)
step = 1;
@@ -1956,6 +1970,8 @@ yuv2ya8_2_c(SwsContext *c, const int16_t *buf[2],
int yalpha1 = 4096 - yalpha;
int i;
+ av_assert2(yalpha <= 4096U);
+
for (i = 0; i < dstW; i++) {
int Y = (buf0[i] * yalpha1 + buf1[i] * yalpha) >> 19;
int A;