mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-09 05:24:55 +00:00
[PR #301] [MERGED] Zlib: fix Adler32 implementation #956
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/adamhathcock/sharpcompress/pull/301
Author: @frabar666
Created: 9/17/2017
Status: ✅ Merged
Merged: 9/17/2017
Merged by: @adamhathcock
Base:
master← Head:fix-adler32📝 Commits (2)
3e29eddZlib: fix Adler32 implementation75de73dMerge branch 'master' into fix-adler32📊 Changes
1 file changed (+4 additions, -4 deletions)
View changed files
📝
src/SharpCompress/Compressors/Deflate/Zlib.cs(+4 -4)📄 Description
ZlibStream'sAdler32routine sometime returns incorrect results, as @ied206 noticed in #298.This fixes #298 by using
uintinstead ofint.There are no unit tests, because the implementation is internal.
PHP's short test cases are OK, but they were already OK before.
My gut says the issue was due to the
%operator not behaving as expected for negativeints, so I tested a 5000-byte 0xFF sequence (to approach the overflow limit at 5552). It exhibits the same pattern as #298, 1st and 5th-8th digits match, but 2nd-4th digits are different: previous implementation returned0x53e07596, new one returns0x54b27596(same as an online Adler32 calculator).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.