Skip to content

Commit 3e3bd07

Browse files
committed
Fix overflow of string reverse iteration
This issue does not appear in CI.
1 parent 0eba3ba commit 3e3bd07

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

vm/src/builtins/pystr.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,11 @@ impl PyIter for PyStrReverseIterator {
180180
break;
181181
}
182182
}
183-
start.unwrap_or(end - 4)
183+
if end < 4 {
184+
start.unwrap_or(0)
185+
} else {
186+
start.unwrap_or(end - 4)
187+
}
184188
};
185189

186190
let stored = zelf.position.swap(start);

0 commit comments

Comments
 (0)