[FFmpeg-devel] [PATCH 1/2] lavu/hash: Fix adler32 calculation

James Almer jamrial at gmail.com
Wed May 15 22:52:39 CEST 2013


Adler must be initialized with a non zero value

Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavutil/hash.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavutil/hash.c b/libavutil/hash.c
index 80bf164..bea2952 100644
--- a/libavutil/hash.c
+++ b/libavutil/hash.c
@@ -116,7 +116,7 @@ void av_hash_init(AVHashContext *ctx)
     case SHA224:  av_sha_init(ctx->ctx, 224); break;
     case SHA256:  av_sha_init(ctx->ctx, 256); break;
     case CRC32:
-    case ADLER32: ctx->crc = 0; break;
+    case ADLER32: ctx->crc = 1; break;
     }
 }
 
@@ -141,8 +141,8 @@ void av_hash_final(AVHashContext *ctx, uint8_t *dst)
     case SHA160:
     case SHA224:
     case SHA256:  av_sha_final(ctx->ctx, dst); break;
-    case CRC32:
-    case ADLER32: AV_WL32(dst, ctx->crc); break;
+    case CRC32:   AV_WL32(dst, ctx->crc); break;
+    case ADLER32: AV_WB32(dst, ctx->crc); break;
     }
 }
 
-- 
1.8.1.5



More information about the ffmpeg-devel mailing list