php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #53213
Patch patch.txt revision 2010-11-01 18:30 UTC by zavasek at yandex dot ru

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);
 }
 
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 01:01:59 2014 UTC