Patch patch.txt for hash related Bug #53213
Patch version 2010-11-01 18:30 UTC
Return to Bug #53213 |
Download this patch
Patch Revisions:
Developer: zavasek@yandex.ru
Index: ext/hash/hash_adler32.c
===================================================================
--- ext/hash/hash_adler32.c (revision 305014)
+++ ext/hash/hash_adler32.c (working copy)
@@ -34,9 +34,16 @@
s[0] = context->state & 0xffff;
s[1] = (context->state >> 16) & 0xffff;
for (i = 0; i < len; ++i) {
- s[0] = (s[0] + input[i]) % 65521;
- s[1] = (s[1] + s[0]) % 65521;
+ s[0] += input[i];
+ s[1] += s[0];
+ if (s[1]>=0x7fffffff)
+ {
+ s[0] = s[0] % 65521;
+ s[1] = s[1] % 65521;
+ }
}
+ s[0] = s[0] % 65521;
+ s[1] = s[1] % 65521;
context->state = s[0] + (s[1] << 16);
}
|