[FFmpeg-cvslog] h264: fix signed overflows in x*0x01010101 expressions

Mans Rullgard git at videolan.org
Mon Oct 10 03:59:49 CEST 2011


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sat Oct  8 21:19:51 2011 +0100| [4d1418cd4f620b382106542d0f33d96e33a0fdae] | committer: Mans Rullgard

h264: fix signed overflows in x*0x01010101 expressions

Signed-off-by: Mans Rullgard <mans at mansr.com>

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

 libavcodec/h264.c        |    2 +-
 libavcodec/h264_mvpred.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 83c26ef..aac1a15 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1668,7 +1668,7 @@ static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, int mb_ty
                                     tr_high= ((uint16_t*)ptr)[3 - linesize/2]*0x0001000100010001ULL;
                                     topright= (uint8_t*) &tr_high;
                                 } else {
-                                    tr= ptr[3 - linesize]*0x01010101;
+                                    tr= ptr[3 - linesize]*0x01010101u;
                                     topright= (uint8_t*) &tr;
                                 }
                             }else
diff --git a/libavcodec/h264_mvpred.h b/libavcodec/h264_mvpred.h
index 4751928..7c7086d 100644
--- a/libavcodec/h264_mvpred.h
+++ b/libavcodec/h264_mvpred.h
@@ -588,7 +588,7 @@ static void fill_decode_caches(H264Context *h, int mb_type){
                 ref_cache[3 - 1*8]= ref[4*top_xy + 3];
             }else{
                 AV_ZERO128(mv_cache[0 - 1*8]);
-                AV_WN32A(&ref_cache[0 - 1*8], ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101);
+                AV_WN32A(&ref_cache[0 - 1*8], ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101u);
             }
 
             if(mb_type & (MB_TYPE_16x8|MB_TYPE_8x8)){



More information about the ffmpeg-cvslog mailing list