grain icon indicating copy to clipboard operation
grain copied to clipboard

String.byteLength incorrect for strings larger than 2GB

Open ospencer opened this issue 4 years ago • 1 comments

String.byteLength naively returns the byte length as a Grain simple number, which is capped at 2^31.

ospencer avatar Dec 10 '21 04:12 ospencer

Just a little clarification. I wrote in the description of PR #1126 that it fixes this issue, but it's not exact. There I actually only fixed it for String in the range between 1 and 2 GiB (exclusive). For 2GiB and up we run into issues because of confusion with signed vs unsigned WasmI32 with a lot of fun issues like strings of negative length. Consider me guilty.

cician avatar Feb 06 '22 15:02 cician