JIABI / xxhash

Automatically exported from code.google.com/p/xxhash
Other
0 stars 0 forks source link

XXH32 with XXH_ACCEPT_NULL_INPUT_POINTER=1 crashes when given NULL pointer #18

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. XXH32(0,0,0);

What is the expected output? What do you see instead?
Access violation reading location 0x10 in XXH_readLE32_align

What version of the product are you using? On what operating system?
r34
Win7-64.  Tested both Win32 and x64 builds

Please provide any additional information below.
The simplest fix I can contrive is to change XXH32_endian_align

209c209
<     const BYTE* const bEnd = p + len;

---
>     const BYTE* bEnd = p + len;
213c213
<     if (p==NULL) { len=0; p=(const BYTE*)(size_t)16; }

---
>     if (p==NULL) { len=0; bEnd=p=(const BYTE*)(size_t)16; }

This returns 46947589 for XXH32(0,0,0). I do not know if that is the 
correct/expected result.

Original issue reported on code.google.com by corys...@gmail.com on 17 May 2014 at 1:06

GoogleCodeExporter commented 8 years ago
I'll look into it

Original comment by yann.col...@gmail.com on 19 May 2014 at 9:59

GoogleCodeExporter commented 8 years ago
Thanks for the bug report.
The behavior and correction are as you said.

A new version of xxHash, integrating your correction, is currently under test, 
at :
https://github.com/Cyan4973/xxHash/tree/dev

Regards

Original comment by yann.col...@gmail.com on 14 Jul 2014 at 3:58

GoogleCodeExporter commented 8 years ago
Corrected into r35

Original comment by yann.col...@gmail.com on 16 Jul 2014 at 9:14