[FFmpeg-cvslog] avcodec/h264dsp_template: Fix undefined shifts
Michael Niedermayer
git at videolan.org
Sun Mar 15 18:20:16 CET 2015
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Mar 15 17:30:10 2015 +0100| [0a4808741e523d3b7b214a945fa2bcb59299896e] | committer: Michael Niedermayer
avcodec/h264dsp_template: Fix undefined shifts
Found-by: Clang -fsanitize=shift
Reported-by: Thierry Foucu <tfoucu at google.com>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0a4808741e523d3b7b214a945fa2bcb59299896e
---
libavcodec/h264dsp_template.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/h264dsp_template.c b/libavcodec/h264dsp_template.c
index 4b42af7..fa11019 100644
--- a/libavcodec/h264dsp_template.c
+++ b/libavcodec/h264dsp_template.c
@@ -237,7 +237,7 @@ static av_always_inline av_flatten void FUNCC(h264_loop_filter_chroma)(uint8_t *
xstride >>= sizeof(pixel)-1;
ystride >>= sizeof(pixel)-1;
for( i = 0; i < 4; i++ ) {
- const int tc = ((tc0[i] - 1) << (BIT_DEPTH - 8)) + 1;
+ const int tc = ((tc0[i] - 1U) << (BIT_DEPTH - 8)) + 1;
if( tc <= 0 ) {
pix += inner_iters*ystride;
continue;
@@ -252,7 +252,7 @@ static av_always_inline av_flatten void FUNCC(h264_loop_filter_chroma)(uint8_t *
FFABS( p1 - p0 ) < beta &&
FFABS( q1 - q0 ) < beta ) {
- int delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
+ int delta = av_clip( ((q0 - p0) * 4 + (p1 - q1) + 4) >> 3, -tc, tc );
pix[-xstride] = av_clip_pixel( p0 + delta ); /* p0' */
pix[0] = av_clip_pixel( q0 - delta ); /* q0' */
More information about the ffmpeg-cvslog
mailing list