summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-05-12 13:52:29 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-13 12:47:30 +0200
commit9a747cb5b7866d440211aa1dc4e07dd4ff914c2c (patch)
treed4de856f1088208ce76e1211d30f8b108a28cd75 /src
parenta8877f529dffa68a8c1339cd10c32e3b783bba66 (diff)
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 <allan.jensen@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qhash.cpp2
1 files changed, 1 insertions, 1 deletions
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<const uint *>(p));
+ h = _mm_crc32_u32(h, *reinterpret_cast<const uint *>(p - 4));
p -= 4;
len = e - p;
# endif