summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-08 02:51:52 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-08 02:51:52 +0200
commitbc721ac9f7753b4175b6888e979db0a1615a1bd9 (patch)
treed9779ff726996d8ca138c885ee91e9542926d590
parent0b5d1b88e09be795a5e7c07a89d84ab47d466457 (diff)
downloadffmpeg-bc721ac9f7753b4175b6888e979db0a1615a1bd9.tar.gz
swscale/utils: Fix potential overflow of dstPos*xInc before converting to 64bit
Fixes CID1061053 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libswscale/utils.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 8fbde7fb0a..3f8796f2dd 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -299,7 +299,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
FF_ALLOC_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * filterSize, fail);
- xDstInSrc = ((dstPos*xInc)>>8) - ((srcPos*0x8000)>>7);
+ xDstInSrc = ((dstPos*(int64_t)xInc)>>8) - ((srcPos*0x8000)>>7);
for (i = 0; i < dstW; i++) {
int xx = (xDstInSrc - ((filterSize - 1) << 15) + (1 << 15)) >> 16;
@@ -315,7 +315,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
FF_ALLOC_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * filterSize, fail);
- xDstInSrc = ((dstPos*xInc)>>8) - ((srcPos*0x8000)>>7);
+ xDstInSrc = ((dstPos*(int64_t)xInc)>>8) - ((srcPos*0x8000)>>7);
for (i = 0; i < dstW; i++) {
int xx = (xDstInSrc - ((filterSize - 1) << 15) + (1 << 15)) >> 16;
int j;
@@ -366,7 +366,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
FF_ALLOC_OR_GOTO(NULL, filter,
dstW * sizeof(*filter) * filterSize, fail);
- xDstInSrc = ((dstPos*xInc)>>7) - ((srcPos*0x10000)>>7);
+ xDstInSrc = ((dstPos*(int64_t)xInc)>>7) - ((srcPos*0x10000)>>7);
for (i = 0; i < dstW; i++) {
int xx = (xDstInSrc - ((filterSize - 2) << 16)) / (1 << 17);
int j;