Skip to content

Behavior of split peg special with "" as first argument #1539

Closed
@sogaiu

Description

@sogaiu

As discussed here, the following invocation:

(peg/match ~(split "" (capture (to -1)))
           "hello there friends")

can lead to:

  • OOM (of janet process) on Linux
  • Crash (of janet process) on macos
  • Machine unresponsive (screen went black and rebooted after waiting a while) on Windows 10

In contrast, the following two invocations do not:

(peg/match ~(any (capture ""))
           "hello there friends")
# =>
@[]

(peg/match ~(some (capture ""))
           "hello there friends")
# =>
nil

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis is not expected behavior, and needs fixing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions