Skip to content

Commit 560cb02

Browse files
authored
Merge pull request #1442 from alexcrichton/fix-encode-into
Fix a bug using `encodeInto` truncating strings
2 parents d3fbf70 + 3906e40 commit 560cb02

File tree

1 file changed

+1
-1
lines changed
  • crates/cli-support/src/js

1 file changed

+1
-1
lines changed

Diff for: crates/cli-support/src/js/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1364,11 +1364,11 @@ impl<'a> Context<'a> {
13641364
while (true) {{
13651365
const view = getUint8Memory().subarray(ptr + writeOffset, ptr + size);
13661366
const {{ read, written }} = cachedTextEncoder.encodeInto(arg, view);
1367+
writeOffset += written;
13671368
if (read === arg.length) {{
13681369
break;
13691370
}}
13701371
arg = arg.substring(read);
1371-
writeOffset += written;
13721372
ptr = wasm.__wbindgen_realloc(ptr, size, size += arg.length * 3);
13731373
}}
13741374
WASM_VECTOR_LEN = writeOffset;

0 commit comments

Comments
 (0)