[FFmpeg-cvslog] vp8: fix signed overflows

Mans Rullgard git at videolan.org
Fri Nov 4 20:49:20 CET 2011


ffmpeg | branch: release/0.7 | Mans Rullgard <mans at mansr.com> | Sat Oct  8 15:03:51 2011 +0100| [f7be632cbde8aa094535edf0af3a30a7556acbac] | committer: Michael Niedermayer

vp8: fix signed overflows

In addition to avoiding undefined behaviour, an unsigned type
makes more sense for packing multiple 8-bit values.

Signed-off-by: Mans Rullgard <mans at mansr.com>
(cherry picked from commit bb59156606e00057a706ed30165bc7329db3823f)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/vp8.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index 3e93653..a417ae3 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -919,7 +919,8 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
                    int mb_x, int mb_y)
 {
     AVCodecContext *avctx = s->avctx;
-    int x, y, mode, nnz, tr;
+    int x, y, mode, nnz;
+    uint32_t tr;
 
     // for the first row, we need to run xchg_mb_border to init the top edge to 127
     // otherwise, skip it if we aren't going to deblock
@@ -948,7 +949,7 @@ void intra_predict(VP8Context *s, uint8_t *dst[3], VP8Macroblock *mb,
         // from the top macroblock
         if (!(!mb_y && avctx->flags & CODEC_FLAG_EMU_EDGE) &&
             mb_x == s->mb_width-1) {
-            tr = tr_right[-1]*0x01010101;
+            tr = tr_right[-1]*0x01010101u;
             tr_right = (uint8_t *)&tr;
         }
 



More information about the ffmpeg-cvslog mailing list