swscale: Fix an undefined behaviour

Prevent a division by zero down the codepath.

Sample-Id: 00001721-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
This commit is contained in:
Luca Barbato
2014-05-02 00:21:23 +02:00
committed by Reinhard Tartler
parent 65c3593792
commit 7fa7270029

View File

@@ -269,7 +269,7 @@ static int initFilter(int16_t **outFilter, int32_t **filterPos, int *outFilterSi
xDstInSrc= xInc - 0x10000;
for (i=0; i<dstW; i++) {
int xx= (xDstInSrc - ((filterSize-2)<<16)) / (1<<17);
int xx = (xDstInSrc - ((int64_t)(filterSize - 2) << 16)) / (1 << 17);
int j;
(*filterPos)[i]= xx;
for (j=0; j<filterSize; j++) {