[FFmpeg-cvslog] hevc: Clip the pixel before shifting

Luca Barbato git at videolan.org
Sat Jan 11 20:38:25 CET 2014


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Sat Jan 11 16:52:41 2014 +0100| [5856bca360c5bc3e340a357d91b1f993c80a7bea] | committer: Michael Niedermayer

hevc: Clip the pixel before shifting

Prevent an out of array bound read.

Fixes: asan_stack-oob_eae8e3_7333_WPP_B_ericsson_MAIN10_2.bit
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5856bca360c5bc3e340a357d91b1f993c80a7bea
---

 libavcodec/hevcdsp_template.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/hevcdsp_template.c b/libavcodec/hevcdsp_template.c
index 553c4c3..a876ee4 100644
--- a/libavcodec/hevcdsp_template.c
+++ b/libavcodec/hevcdsp_template.c
@@ -395,7 +395,7 @@ static void FUNC(sao_band_filter)(uint8_t *_dst, uint8_t *_src,
         offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1];
     for (y = 0; y < height; y++) {
         for (x = 0; x < width; x++)
-            dst[x] = av_clip_pixel(src[x] + offset_table[av_clip_pixel(src[x] >> shift)]);
+            dst[x] = av_clip_pixel(src[x] + offset_table[av_clip_pixel(src[x]) >> shift]);
         dst += stride;
         src += stride;
     }



More information about the ffmpeg-cvslog mailing list