aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-01 19:24:24 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-01 19:35:12 +0100
commit32f0c658283e2451add02a6ee5c719efa877a34c (patch)
tree654e582231346aaa07f4f0961054365d29b33fdd
parent80c702efeb7b4d9edaae52ed5d8dd081a2ccb64b (diff)
downloadffmpeg-32f0c658283e2451add02a6ee5c719efa877a34c.tar.gz
vc1: fix out of array reads in vc1_inv_trans_4x4_c()
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/vc1dsp.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c
index d893d692b4..91578a74b8 100644
--- a/libavcodec/vc1dsp.c
+++ b/libavcodec/vc1dsp.c
@@ -494,7 +494,6 @@ static void vc1_inv_trans_4x4_c(uint8_t *dest, int linesize, DCTELEM *block)
int i;
register int t1,t2,t3,t4;
DCTELEM *src, *dst;
- const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
src = block;
dst = block;
@@ -520,10 +519,10 @@ static void vc1_inv_trans_4x4_c(uint8_t *dest, int linesize, DCTELEM *block)
t3 = 22 * src[ 8] + 10 * src[24];
t4 = 22 * src[24] - 10 * src[ 8];
- dest[0*linesize] = cm[dest[0*linesize] + ((t1 + t3) >> 7)];
- dest[1*linesize] = cm[dest[1*linesize] + ((t2 - t4) >> 7)];
- dest[2*linesize] = cm[dest[2*linesize] + ((t2 + t4) >> 7)];
- dest[3*linesize] = cm[dest[3*linesize] + ((t1 - t3) >> 7)];
+ dest[0*linesize] = av_clip_uint8(dest[0*linesize] + ((t1 + t3) >> 7));
+ dest[1*linesize] = av_clip_uint8(dest[1*linesize] + ((t2 - t4) >> 7));
+ dest[2*linesize] = av_clip_uint8(dest[2*linesize] + ((t2 + t4) >> 7));
+ dest[3*linesize] = av_clip_uint8(dest[3*linesize] + ((t1 - t3) >> 7));
src ++;
dest++;