Open Oipo opened 4 years ago
For SIMD version, I think it is needed to add padding to the source string.
Is there a way to know how much? Just adding 4 or 8 bytes doesn't seem to always work, there'll just be another example that goes wrong.
Currently RapidJSON supports up to SSE 4.1, 16 bytes alignment should be sufficient.
Though it doesn't show in this minimal example, having to add padding to the buffers I get from my network library would add an extra memory allocation, negating the gain from using SSE 4 instructions. I'll just disable them for now.
The following program causes a heap buffer overflow, sometimes a segfault:
Compile with
g++ -fsanitize=address -g3 -mavx -I rapidjson/include test.cpp
Address sanitizer output: