Skip to content

Commit a7d3685

Browse files
committed
Use checked conversion for FileIO growth limit
Assisted-by: OpenAI Codex:model version not exposed
1 parent 907c0d3 commit a7d3685

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎crates/vm/src/stdlib/_io.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6426,7 +6426,7 @@ mod fileio {
64266426
// Match FileIO's amortized growth while leaving at least
64276427
// one byte for the read that detects EOF.
64286428
let growth = if used > 65_536 { used >> 3 } else { used + 256 }.max(8192);
6429-
let size = used.checked_add(growth).filter(|&n| n <= isize::MAX as usize)
6429+
let size = used.checked_add(growth).filter(|&n| isize::try_from(n).is_ok())
64306430
.ok_or_else(|| vm.new_overflow_error(
64316431
"unbounded read returned more bytes than a Python bytes object can hold"
64326432
))?;

0 commit comments

Comments
 (0)