This commit is contained in:
Daniel Lemire
2019-05-19 12:25:27 -04:00
committed by GitHub
parent 47beaff152
commit dcd0cb8080
3 changed files with 15 additions and 7 deletions
+7 -1
View File
@@ -74,7 +74,13 @@ bool ParsedJson::allocateCapacity(size_t len, size_t maxdepth) {
return false;
}
/*
// We do not need to initialize this content for parsing, though we could
// need to initialize it for safety.
memset(string_buf, 0 , localstringcapacity);
memset(structural_indexes, 0, max_structures * sizeof(uint32_t));
memset(tape, 0, localtapecapacity * sizeof(uint64_t));
*/
bytecapacity = len;
depthcapacity = maxdepth;
tapecapacity = localtapecapacity;
+3
View File
@@ -72,6 +72,9 @@ really_inline bool is_valid_null_atom(const uint8_t *loc) {
***********/
WARN_UNUSED ALLOW_SAME_PAGE_BUFFER_OVERRUN_QUALIFIER LENIENT_MEM_SANITIZER
int unified_machine(const uint8_t *buf, size_t len, ParsedJson &pj) {
#ifndef ALLOW_SAME_PAGE_BUFFER_OVERRUN
memset((uint8_t*)buf + len, 0, SIMDJSON_PADDING); // to please valgrind
#endif
uint32_t i = 0; // index of the structural character (0,1,2,3...)
uint32_t idx; // location of the structural character in the input (buf)
uint8_t c; // used to track the (structural) character we are looking at, updated