mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Check int(abs) instead to avoid overflows
This commit is contained in:
@@ -323,11 +323,12 @@ buffer_seek :: proc(b: ^Buffer, offset: i64, whence: io.Seek_From) -> (i64, io.E
|
|||||||
return 0, .Invalid_Whence
|
return 0, .Invalid_Whence
|
||||||
}
|
}
|
||||||
|
|
||||||
if abs < 0 {
|
abs_int := int(abs)
|
||||||
|
if abs_int < 0 {
|
||||||
return 0, .Invalid_Offset
|
return 0, .Invalid_Offset
|
||||||
}
|
}
|
||||||
b.last_read = .Invalid
|
b.last_read = .Invalid
|
||||||
b.off = int(abs)
|
b.off = abs_int
|
||||||
return abs, nil
|
return abs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user