[FFmpeg-cvslog] crc: fix signed overflow

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


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Sat Oct  8 01:59:51 2011 +0100| [8b19ae07616bbd18969b94cbf5d74308a8f2bbdf] | committer: Mans Rullgard

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>

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

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

diff --git a/libavutil/crc.c b/libavutil/crc.c
index 6c9f928..44719ff 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