diff options
| author | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-08-22 18:19:55 -0400 |
|---|---|---|
| committer | Laytan <laytanlaats@hotmail.com> | 2024-08-28 19:53:20 +0200 |
| commit | 6798d15ecb96e28f35f1a38d6bbc3ea1de10b423 (patch) | |
| tree | 0dd2c734899e96bfaf7ed25e2d3ed22b68c66435 /core/bytes/buffer.odin | |
| parent | 6aedb2695a5094aac15758ef79c3af84be27df38 (diff) | |
Check `int(abs)` instead to avoid overflows
Diffstat (limited to 'core/bytes/buffer.odin')
| -rw-r--r-- | core/bytes/buffer.odin | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/bytes/buffer.odin b/core/bytes/buffer.odin index 0399beea4..a61f8f00d 100644 --- a/core/bytes/buffer.odin +++ b/core/bytes/buffer.odin @@ -323,11 +323,12 @@ buffer_seek :: proc(b: ^Buffer, offset: i64, whence: io.Seek_From) -> (i64, io.E return 0, .Invalid_Whence } - if abs < 0 { + abs_int := int(abs) + if abs_int < 0 { return 0, .Invalid_Offset } b.last_read = .Invalid - b.off = int(abs) + b.off = abs_int return abs, nil } |