From 1ae98ee177a47d8794a42eb4349e86cd5be3bec1 Mon Sep 17 00:00:00 2001 From: Noa Date: Fri, 16 May 2025 14:17:25 -0500 Subject: [PATCH 1/2] Fix panic with high precision --- compiler/literal/src/float.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/literal/src/float.rs b/compiler/literal/src/float.rs index 49771b8184..3764323de3 100644 --- a/compiler/literal/src/float.rs +++ b/compiler/literal/src/float.rs @@ -55,6 +55,7 @@ pub fn format_fixed(precision: usize, magnitude: f64, case: Case, alternate_form match magnitude { magnitude if magnitude.is_finite() => { let point = decimal_point_or_empty(precision, alternate_form); + let precision = std::cmp::min(precision, u16::MAX as usize); format!("{magnitude:.precision$}{point}") } magnitude if magnitude.is_nan() => format_nan(case), From 163296d306206698dfb03c9a4a4239b15b99627b Mon Sep 17 00:00:00 2001 From: Noa Date: Fri, 16 May 2025 15:20:10 -0500 Subject: [PATCH 2/2] Fix test_memoryio --- vm/src/stdlib/io.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vm/src/stdlib/io.rs b/vm/src/stdlib/io.rs index 3e1979e3d0..e4339ae61a 100644 --- a/vm/src/stdlib/io.rs +++ b/vm/src/stdlib/io.rs @@ -259,6 +259,9 @@ mod _io { } fn write(&mut self, data: &[u8]) -> Option { + if data.is_empty() { + return Some(0); + } let length = data.len(); self.cursor.write_all(data).ok()?; Some(length as u64)