mirror of
https://github.com/janet-lang/janet
synced 2025-09-07 21:36:08 +00:00
Address issue #1539 - infinite loop in peg split
Other looping rules ensure forward progress by terminating if an iteration is at the same location as the previous iteration. Do the same for split.
This commit is contained in:
@@ -772,5 +772,16 @@
|
||||
"5:apple6:banana6:cherry"
|
||||
@["apple" "banana" "cherry"])
|
||||
|
||||
# Issue #1539 - make sure split with "" doesn't infinite loop/oom
|
||||
(test "issue 1539"
|
||||
~(split "" (capture (to -1)))
|
||||
"hello there friends"
|
||||
nil)
|
||||
|
||||
(test "issue 1539 pt. 2"
|
||||
~(split "," (capture 0))
|
||||
"abc123,,,,"
|
||||
@["" "" "" "" ""])
|
||||
|
||||
(end-suite)
|
||||
|
||||
|
Reference in New Issue
Block a user