From 9a747cb5b7866d440211aa1dc4e07dd4ff914c2c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 12 May 2014 13:52:29 -0700 Subject: Fix an off-by-4 error in qHash with CRC32 I tested only the 64-bit build. The 32-bit build was reading garbage past the end of the strings in some cases. Change-Id: If6d239754e16a17cc4e8bb71e2b7778429dfa7ba Reviewed-by: Allan Sandfeld Jensen Reviewed-by: Lars Knoll --- src/corelib/tools/qhash.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index a5d14a3535..ca645636e4 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -125,7 +125,7 @@ static uint crc32(const Char *ptr, size_t len, uint h) # else p += 4; for ( ; p <= e; p += 4) - h = _mm_crc32_u32(h, *reinterpret_cast(p)); + h = _mm_crc32_u32(h, *reinterpret_cast(p - 4)); p -= 4; len = e - p; # endif -- cgit v1.2.3