Commit fd88a257 authored by Michael Niedermayer's avatar Michael Niedermayer

rv34dsp: avoid use of crop table for idct.

Fixes out of array read.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 8263212e
...@@ -55,7 +55,6 @@ static av_always_inline void rv34_row_transform(int temp[16], DCTELEM *block) ...@@ -55,7 +55,6 @@ static av_always_inline void rv34_row_transform(int temp[16], DCTELEM *block)
*/ */
static void rv34_idct_add_c(uint8_t *dst, ptrdiff_t stride, DCTELEM *block){ static void rv34_idct_add_c(uint8_t *dst, ptrdiff_t stride, DCTELEM *block){
int temp[16]; int temp[16];
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int i; int i;
rv34_row_transform(temp, block); rv34_row_transform(temp, block);
...@@ -67,10 +66,10 @@ static void rv34_idct_add_c(uint8_t *dst, ptrdiff_t stride, DCTELEM *block){ ...@@ -67,10 +66,10 @@ static void rv34_idct_add_c(uint8_t *dst, ptrdiff_t stride, DCTELEM *block){
const int z2 = 7* temp[4*1+i] - 17*temp[4*3+i]; const int z2 = 7* temp[4*1+i] - 17*temp[4*3+i];
const int z3 = 17* temp[4*1+i] + 7*temp[4*3+i]; const int z3 = 17* temp[4*1+i] + 7*temp[4*3+i];
dst[0] = cm[ dst[0] + ( (z0 + z3) >> 10 ) ]; dst[0] = av_clip_uint8( dst[0] + ( (z0 + z3) >> 10 ) );
dst[1] = cm[ dst[1] + ( (z1 + z2) >> 10 ) ]; dst[1] = av_clip_uint8( dst[1] + ( (z1 + z2) >> 10 ) );
dst[2] = cm[ dst[2] + ( (z1 - z2) >> 10 ) ]; dst[2] = av_clip_uint8( dst[2] + ( (z1 - z2) >> 10 ) );
dst[3] = cm[ dst[3] + ( (z0 - z3) >> 10 ) ]; dst[3] = av_clip_uint8( dst[3] + ( (z0 - z3) >> 10 ) );
dst += stride; dst += stride;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment