Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

Commit

Permalink
Truncate inputs to setbuffer8/64 in bytearray
Browse files Browse the repository at this point in the history
  • Loading branch information
edfelten committed Feb 26, 2022
1 parent ca8dd11 commit ecefefb
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion arb_os/arbos-upgrade.mexe

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion arb_os/arbos.mexe

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion arb_os/upgrade.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion looptest/upgrade2_old.mexe

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions stdlib/bytearray.mini
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public throw func bytearray_setByte(ba: ByteArray, offset: uint, value: uint) ->
}
offset = offset + ba.sliceOffset;
}
ba with { contents: setbuffer8(ba.contents, offset, value) }
ba with { contents: setbuffer8(ba.contents, offset, value & 0xff) }
}

// bytearray_set64 writes an 8-byte chunk to a ByteArray, returning the resulting ByteArray
Expand All @@ -270,7 +270,7 @@ public throw func bytearray_set64(ba: ByteArray, offset: uint, value: uint) -> B
offset = offset + ba.sliceOffset;
}

ba with { contents: setbuffer64(ba.contents, offset, value) }
ba with { contents: setbuffer64(ba.contents, offset, value & 0xffffffffffffffff) }
}

// bytearray_set256 writes a 32-byte chunk to a ByteArray, returning the resulting ByteArray
Expand Down
2 changes: 1 addition & 1 deletion upgradetests/upgrade1_old.mexe

Large diffs are not rendered by default.

0 comments on commit ecefefb

Please sign in to comment.