Skip to content

Commit

Permalink
Merge pull request #2808 from karl-zylinski/write-128-bit-int-buf-size
Browse files Browse the repository at this point in the history
Fix for crash when using io.write_u128/io.write_i128 due to buffer being too small
  • Loading branch information
gingerBill authored Sep 22, 2023
2 parents c23b582 + 39c85ca commit e14a4e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/io/util.odin
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ write_int :: proc(w: Writer, i: int, base: int = 10, n_written: ^int = nil) -> (
}

write_u128 :: proc(w: Writer, i: u128, base: int = 10, n_written: ^int = nil) -> (n: int, err: Error) {
buf: [32]byte
buf: [39]byte
s := strconv.append_bits_128(buf[:], i, base, false, 128, strconv.digits, nil)
return write_string(w, s, n_written)
}
write_i128 :: proc(w: Writer, i: i128, base: int = 10, n_written: ^int = nil) -> (n: int, err: Error) {
buf: [32]byte
buf: [40]byte
s := strconv.append_bits_128(buf[:], u128(i), base, true, 128, strconv.digits, nil)
return write_string(w, s, n_written)
}
Expand Down

0 comments on commit e14a4e7

Please sign in to comment.