[LLVMdev] [LLVMDev] The ComputeHash algorithm in FoldingSet is unsafe
Xu Zhongxing
xuzhongxing at foxmail.com
Mon Sep 26 07:11:51 PDT 2011
I use FoldingSet to save some data structures. And I found somehow it always abandon a new node. I tracked the bug into the ComputeHash() function of FoldingSet. It computes the SAME hash value for these two 32-bit unsigned integer sequences:
size: 17
4144534024, 32767, 4146895704, 32767, 4027803688, 32767, 4026983736, 32767, 4147202696, 32767, 4026587256, 32767, 0, 4026589472, 32767, 0, 0,
size: 16
4030909168, 32767, 4028631392, 32767, 4029542384, 32767, 0, 4028487592, 32767, 4026587256, 32767, 0, 4026589472, 32767, 0, 0,
The hash value is 2111586599
The test code is attached.
What should we do with it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110926/854bfa82/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-hash.cpp
Type: application/octet-stream
Size: 1143 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110926/854bfa82/attachment.obj>
More information about the llvm-dev
mailing list