Fixing issue 906 (#912)

* Fixing issue 906

* Safe patching.

* Now with explanations.

* Bumping up memory allocation.

* Putting the patch back.

* fallback fixes.

Co-authored-by: Daniel Lemire <lemire@gmai.com>
This commit is contained in:
Daniel Lemire
2020-06-05 15:37:09 -04:00
committed by GitHub
parent 351717414d
commit 7a69da16e4
9 changed files with 66 additions and 5 deletions
@@ -133,6 +133,10 @@ really_inline error_code scan() {
}
*next_structural_index = len;
next_structural_index++;
// We pad beyond.
// https://github.com/simdjson/simdjson/issues/906
next_structural_index[0] = len;
next_structural_index[1] = 0;
parser.n_structural_indexes = uint32_t(next_structural_index - parser.structural_indexes.get());
return error;
}
@@ -234,6 +238,8 @@ namespace fallback {
WARN_UNUSED error_code dom_parser_implementation::parse(const uint8_t *_buf, size_t _len, dom::document &_doc) noexcept {
error_code err = stage1(_buf, _len, false);
if (err) { return err; }
err = check_for_unclosed_array();
if (err) { return err; }
return stage2(_doc);
}