Open alenloncaric opened 3 years ago
Some tools detect out-of-bound read when SSE optimization is used. This is actually considered safe and would not access out of page boundary. But if you really want to remove this out-of-bound issue, you can append 16 bytes (width of SSE load).
You can do it with std::string
.
~~IMHO current behavior of insitu
is too dangerous. It simply writes into the given buffer without checking char array boundary.
This may results in undefined behavior such as crash or memory corruption.~~
IMHO current behavior of
insitu
is too dangerous. It simply writes into the given buffer without checking char array boundary. This may results in undefined behavior such as crash or memory corruption.
That is not related to this issue related to SIMD. Insitu parsing is designed to be safe, with the decoded string always shorter than the source string. It will not write across boundary to the in/out zero-terminated string.
Sorry about my previous comment, I have confirmed that insitu parsing does provide decoded string does not exceeds original length of the string.
AFAICT, it switches ending "
to \0
if given key or value is not \0
terminated.
Dear,
I saw somewhere that for insitu we need to reserve few bytes at the end ? How much ? Can I do insitu parsing over std::string ? being resized by those few bytes?
Something like: response.resize(response.length() + 16); char* cstr = &response[0]; d.ParseInsitu<0>(cstr);
With kind regards,