[FFmpeg-cvslog] crc: fix signed overflow

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


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

crc: fix signed overflow

This fixes a signed overflow from i << 24 when i == 255 by
making i unsigned.  The result of the shift is already
assigned to an variable of unsigned type.

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

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

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

 libavutil/crc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavutil/crc.c b/libavutil/crc.c
index c3d74a2..d0e736e 100644
--- a/libavutil/crc.c
+++ b/libavutil/crc.c
@@ -57,7 +57,7 @@ static AVCRC av_crc_table[AV_CRC_MAX][257];
  * @return <0 on failure
  */
 int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){
-    int i, j;
+    unsigned i, j;
     uint32_t c;
 
     if (bits < 8 || bits > 32 || poly >= (1LL<<bits))



More information about the ffmpeg-cvslog mailing list