summaryrefslogtreecommitdiff
path: root/libswscale
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-09-15 23:10:16 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-09-15 23:10:26 +0200
commit62101030c4ff23c61046a70cd27a627dfb0e0e54 (patch)
tree8837cb836ad73deea83be440cc8d315ba2f601ce /libswscale
parente78d1a594a0a4942b2c39170df10b9f36f9b8d08 (diff)
parentea540401d6082474df8364169e2041e29e4dc407 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: swscale: fix byte overreads in SSE-optimized hscale(). matroskadec: fix typo. matroskadec: bail on parsing of incorrect seek index segments Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/utils.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c
index c112fa3264..8b793f7f84 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -186,8 +186,8 @@ static int initFilter(int16_t **outFilter, int16_t **filterPos, int *outFilterSi
emms_c(); //FIXME this should not be required but it IS (even for non-MMX versions)
- // NOTE: the +1 is for the MMX scaler which reads over the end
- FF_ALLOC_OR_GOTO(NULL, *filterPos, (dstW+1)*sizeof(int16_t), fail);
+ // NOTE: the +3 is for the MMX(+1)/SSE(+3) scaler which reads over the end
+ FF_ALLOC_OR_GOTO(NULL, *filterPos, (dstW+3)*sizeof(int16_t), fail);
if (FFABS(xInc - 0x10000) <10) { // unscaled
int i;
@@ -473,7 +473,7 @@ static int initFilter(int16_t **outFilter, int16_t **filterPos, int *outFilterSi
// Note the +1 is for the MMX scaler which reads over the end
/* align at 16 for AltiVec (needed by hScale_altivec_real) */
- FF_ALLOCZ_OR_GOTO(NULL, *outFilter, *outFilterSize*(dstW+1)*sizeof(int16_t), fail);
+ FF_ALLOCZ_OR_GOTO(NULL, *outFilter, *outFilterSize*(dstW+3)*sizeof(int16_t), fail);
/* normalize & store in outFilter */
for (i=0; i<dstW; i++) {
@@ -493,10 +493,14 @@ static int initFilter(int16_t **outFilter, int16_t **filterPos, int *outFilterSi
}
}
- (*filterPos)[dstW]= (*filterPos)[dstW-1]; // the MMX scaler will read over the end
+ (*filterPos)[dstW+0] =
+ (*filterPos)[dstW+1] =
+ (*filterPos)[dstW+2] = (*filterPos)[dstW-1]; // the MMX/SSE scaler will read over the end
for (i=0; i<*outFilterSize; i++) {
- int j= dstW*(*outFilterSize);
- (*outFilter)[j + i]= (*outFilter)[j + i - (*outFilterSize)];
+ int k= (dstW - 1) * (*outFilterSize) + i;
+ (*outFilter)[k + 1 * (*outFilterSize)] =
+ (*outFilter)[k + 2 * (*outFilterSize)] =
+ (*outFilter)[k + 3 * (*outFilterSize)] = (*outFilter)[k];
}
ret=0;