Skip to content
Snippets Groups Projects
  • Josh Meredith's avatar
    2ee60455
    JS: fix bounds checking (Issue 23123) · 2ee60455
    Josh Meredith authored and Marge Bot's avatar Marge Bot committed
    * 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.
    2ee60455
    History
    JS: fix bounds checking (Issue 23123)
    Josh Meredith authored and Marge Bot's avatar Marge Bot committed
    * 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.
Code owners