Skip to content

Commit

Permalink
Fix bounds checks when accessing buffer byte by index
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Livesey committed Aug 15, 2024
1 parent f24b22d commit 75a2890
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/libvoxel.h
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ void voxel_builtins_core_getBufferByte(voxel_Executor* executor) {
index = buffer->size + index;
}

if (index < 0 && index >= buffer->size) {
if (index < 0 || index >= buffer->size) {
voxel_pushNull(executor);

goto voxel_finally;
Expand Down
2 changes: 1 addition & 1 deletion src/builtins/core/buffers.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void voxel_builtins_core_getBufferByte(voxel_Executor* executor) {
index = buffer->size + index;
}

if (index < 0 && index >= buffer->size) {
if (index < 0 || index >= buffer->size) {
voxel_pushNull(executor);

goto voxel_finally;
Expand Down

0 comments on commit 75a2890

Please sign in to comment.