Fixing issue 351 (#352)

* Fixing issues 351 and 353
This commit is contained in:
Daniel Lemire 2019-11-01 16:05:28 -04:00 committed by GitHub
parent 17b777f751
commit b1224a77db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

1
jsonchecker/fail75.json Normal file
View File

@ -0,0 +1 @@
f

1
jsonchecker/pass24.json Normal file
View File

@ -0,0 +1 @@
-7.9431

View File

@ -107,7 +107,7 @@ unified_machine(const uint8_t *buf, size_t len, ParsedJson &pj) {
goto fail;
}
memcpy(copy, buf, len);
copy[len] = ' ';
memset(copy + len, ' ', sizeof(uint64_t));
if (!is_valid_true_atom(reinterpret_cast<const uint8_t *>(copy) + idx)) {
free(copy);
goto fail;
@ -127,7 +127,7 @@ unified_machine(const uint8_t *buf, size_t len, ParsedJson &pj) {
goto fail;
}
memcpy(copy, buf, len);
copy[len] = ' ';
memset(copy + len, ' ', sizeof(uint64_t));
if (!is_valid_false_atom(reinterpret_cast<const uint8_t *>(copy) + idx)) {
free(copy);
goto fail;
@ -146,7 +146,7 @@ unified_machine(const uint8_t *buf, size_t len, ParsedJson &pj) {
goto fail;
}
memcpy(copy, buf, len);
copy[len] = ' ';
memset(copy + len, ' ', sizeof(uint64_t));
if (!is_valid_null_atom(reinterpret_cast<const uint8_t *>(copy) + idx)) {
free(copy);
goto fail;
@ -178,7 +178,7 @@ unified_machine(const uint8_t *buf, size_t len, ParsedJson &pj) {
goto fail;
}
memcpy(copy, buf, len);
copy[len] = ' ';
memset(copy + len, ' ', SIMDJSON_PADDING);
if (!parse_number(reinterpret_cast<const uint8_t *>(copy), pj, idx,
false)) {
free(copy);
@ -197,7 +197,7 @@ unified_machine(const uint8_t *buf, size_t len, ParsedJson &pj) {
goto fail;
}
memcpy(copy, buf, len);
copy[len] = ' ';
memset(copy + len, ' ', SIMDJSON_PADDING);
if (!parse_number(reinterpret_cast<const uint8_t *>(copy), pj, idx, true)) {
free(copy);
goto fail;