From 12cf61c3b26151806c87ba8774503673e407ac33 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 16 Mar 2015 14:27:11 +0100 Subject: [PATCH] avcodec/hevc: Fix undefined shifts Found-by: Clang -fsanitize=shift Reported-by: Thierry Foucu Signed-off-by: Michael Niedermayer --- libavcodec/hevc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c index b7ad29a081..feb8cd4114 100644 --- a/libavcodec/hevc.c +++ b/libavcodec/hevc.c @@ -858,7 +858,7 @@ static void hls_sao_param(HEVCContext *s, int rx, int ry) } else if (sao->offset_sign[c_idx][i]) { sao->offset_val[c_idx][i + 1] = -sao->offset_val[c_idx][i + 1]; } - sao->offset_val[c_idx][i + 1] <<= log2_sao_offset_scale; + sao->offset_val[c_idx][i + 1] *= 1 << log2_sao_offset_scale; } } } @@ -1300,7 +1300,7 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, x_off += mv->x >> 2; y_off += mv->y >> 2; - src += y_off * srcstride + (x_off << s->sps->pixel_shift); + src += y_off * srcstride + x_off * (1 << s->sps->pixel_shift); if (x_off < QPEL_EXTRA_BEFORE || y_off < QPEL_EXTRA_AFTER || x_off >= pic_width - block_w - QPEL_EXTRA_AFTER || @@ -1455,7 +1455,7 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, x_off += mv->x >> (2 + hshift); y_off += mv->y >> (2 + vshift); - src0 += y_off * srcstride + (x_off << s->sps->pixel_shift); + src0 += y_off * srcstride + x_off * (1 << s->sps->pixel_shift); if (x_off < EPEL_EXTRA_BEFORE || y_off < EPEL_EXTRA_AFTER || x_off >= pic_width - block_w - EPEL_EXTRA_AFTER ||