diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-03-31 16:22:30 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-03-31 16:35:54 +0200 |
commit | f9143d2407b38f33b85487fd597c9194f79adb20 (patch) | |
tree | e158c1b4c5f44caadba1be6a525b81f4f7c60239 /libavcodec/ivi_dsp.c | |
parent | 12038ab16da2f9e007c5f3a5bacc19e61f8edfd8 (diff) | |
download | ffmpeg-f9143d2407b38f33b85487fd597c9194f79adb20.tar.gz |
ividsp: prevent pointers from going outside and overreading.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ivi_dsp.c')
-rw-r--r-- | libavcodec/ivi_dsp.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libavcodec/ivi_dsp.c b/libavcodec/ivi_dsp.c index 263c06ace3..bedd5dc93c 100644 --- a/libavcodec/ivi_dsp.c +++ b/libavcodec/ivi_dsp.c @@ -87,6 +87,13 @@ void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst, } for (x = 0, indx = 0; x < plane->width; x+=2, indx++) { + if (x+2 >= plane->width) { + b0_ptr --; + b1_ptr --; + b2_ptr --; + b3_ptr --; + } + /* some values calculated in the previous iterations can */ /* be reused in the next ones, so do appropriate copying */ b2_1 = b2_2; // b2[x-1,y ] = b2[x, y ] @@ -174,10 +181,10 @@ void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst, back_pitch = -pitch; - b0_ptr += pitch; - b1_ptr += pitch; - b2_ptr += pitch; - b3_ptr += pitch; + b0_ptr += pitch + 1; + b1_ptr += pitch + 1; + b2_ptr += pitch + 1; + b3_ptr += pitch + 1; } } |