[FFmpeg-cvslog] snow: fix integer overflows
Mans Rullgard
git at videolan.org
Sun Nov 27 00:39:17 CET 2011
ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sat Nov 26 20:59:17 2011 +0000| [8540dcfd7af14da4080770dfbfa997cffdd0878b] | committer: Mans Rullgard
snow: fix integer overflows
The way these values are used, they should have an unsigned type.
A similar change was made for mpegvideo in cb66847.
Signed-off-by: Mans Rullgard <mans at mansr.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8540dcfd7af14da4080770dfbfa997cffdd0878b
---
libavcodec/snow.h | 4 ++--
libavcodec/snowenc.c | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index f43deb1..bd54994 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -154,8 +154,8 @@ typedef struct SnowContext{
Plane plane[MAX_PLANES];
BlockNode *block;
#define ME_CACHE_SIZE 1024
- int me_cache[ME_CACHE_SIZE];
- int me_cache_generation;
+ unsigned me_cache[ME_CACHE_SIZE];
+ unsigned me_cache_generation;
slice_buffer sb;
int memc_only;
diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 4926eef..cd60c3a 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -958,7 +958,8 @@ static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int
const int b_stride= s->b_width << s->block_max_depth;
BlockNode *block= &s->block[mb_x + mb_y * b_stride];
BlockNode backup= *block;
- int rd, index, value;
+ unsigned value;
+ int rd, index;
assert(mb_x>=0 && mb_y>=0);
assert(mb_x<b_stride);
@@ -1003,7 +1004,8 @@ static av_always_inline int check_4block_inter(SnowContext *s, int mb_x, int mb_
const int b_stride= s->b_width << s->block_max_depth;
BlockNode *block= &s->block[mb_x + mb_y * b_stride];
BlockNode backup[4]= {block[0], block[1], block[b_stride], block[b_stride+1]};
- int rd, index, value;
+ unsigned value;
+ int rd, index;
assert(mb_x>=0 && mb_y>=0);
assert(mb_x<b_stride);
More information about the ffmpeg-cvslog
mailing list