Skip to content

Commit b1224a7

Browse files
authored
Fixing issue 351 (simdjson#352)
* Fixing issues 351 and 353
1 parent 17b777f commit b1224a7

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

jsonchecker/fail75.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
f

jsonchecker/pass24.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-7.9431

src/generic/stage2_build_tape.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ unified_machine(const uint8_t *buf, size_t len, ParsedJson &pj) {
107107
goto fail;
108108
}
109109
memcpy(copy, buf, len);
110-
copy[len] = ' ';
110+
memset(copy + len, ' ', sizeof(uint64_t));
111111
if (!is_valid_true_atom(reinterpret_cast<const uint8_t *>(copy) + idx)) {
112112
free(copy);
113113
goto fail;
@@ -127,7 +127,7 @@ unified_machine(const uint8_t *buf, size_t len, ParsedJson &pj) {
127127
goto fail;
128128
}
129129
memcpy(copy, buf, len);
130-
copy[len] = ' ';
130+
memset(copy + len, ' ', sizeof(uint64_t));
131131
if (!is_valid_false_atom(reinterpret_cast<const uint8_t *>(copy) + idx)) {
132132
free(copy);
133133
goto fail;
@@ -146,7 +146,7 @@ unified_machine(const uint8_t *buf, size_t len, ParsedJson &pj) {
146146
goto fail;
147147
}
148148
memcpy(copy, buf, len);
149-
copy[len] = ' ';
149+
memset(copy + len, ' ', sizeof(uint64_t));
150150
if (!is_valid_null_atom(reinterpret_cast<const uint8_t *>(copy) + idx)) {
151151
free(copy);
152152
goto fail;
@@ -178,7 +178,7 @@ unified_machine(const uint8_t *buf, size_t len, ParsedJson &pj) {
178178
goto fail;
179179
}
180180
memcpy(copy, buf, len);
181-
copy[len] = ' ';
181+
memset(copy + len, ' ', SIMDJSON_PADDING);
182182
if (!parse_number(reinterpret_cast<const uint8_t *>(copy), pj, idx,
183183
false)) {
184184
free(copy);
@@ -197,7 +197,7 @@ unified_machine(const uint8_t *buf, size_t len, ParsedJson &pj) {
197197
goto fail;
198198
}
199199
memcpy(copy, buf, len);
200-
copy[len] = ' ';
200+
memset(copy + len, ' ', SIMDJSON_PADDING);
201201
if (!parse_number(reinterpret_cast<const uint8_t *>(copy), pj, idx, true)) {
202202
free(copy);
203203
goto fail;

0 commit comments

Comments
 (0)