perhaps this fixes that UB
bendn 4 weeks ago
parent 74411bf · commit b77f981
-rw-r--r--src/lib.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 5ec8c07..e5679aa 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -557,7 +557,10 @@ fn into(
read!(while 10);
read!(if 4);
- let n = with.width() - wx_;
+ let mut n = with.width() - wx_;
+ if n + x_ > i.width() {
+ n = i.width() - x_ - 1;
+ };
unsafe { core::hint::assert_unchecked(n < 10) };
for k in 0..n {
let x = k + wx_;