diff options
author | Josh Meredith <joshmeredith2008@gmail.com> | 2023-04-03 15:28:41 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-05-04 14:58:51 -0400 |
commit | 116d7312ec4c76f75a26bd0ad2b2815710049e0e (patch) | |
tree | 60cf1fa25416f04998e1905afb39b88464ccd424 /libraries | |
parent | 944a9b94ceea429f05f336a035088b1ebd26ddc4 (diff) | |
download | haskell-116d7312ec4c76f75a26bd0ad2b2815710049e0e.tar.gz |
JS: fix bounds checking (Issue 23123)
* For ByteArray-based bounds-checking, the JavaScript backend must use the
`len` field, instead of the inbuild JavaScript `length` field.
* Range-based operations must also check both the start and end of the range
for bounds
* All indicies are valid for ranges of size zero, since they are essentially no-ops
* For cases of ByteArray accesses (e.g. read as Int), the end index is
(i * sizeof(type) + sizeof(type) - 1), while the previous implementation
uses (i + sizeof(type) - 1). In the Int32 example, this is (i * 4 + 3)
* IndexByteArrayOp_Word8As* primitives use byte array indicies (unlike
the previous point), but now check both start and end indicies
* Byte array copies now check if the arrays are the same by identity and
then if the ranges overlap.
Diffstat (limited to 'libraries')
0 files changed, 0 insertions, 0 deletions