Skip to content

server: PEG until() accepts a missing final delimiter #39

Description

@am17an

Upstream: ggml-org#27772

A final, non-lenient PEG parse incorrectly succeeds when until() reaches end-of-input without finding its delimiter.

Environment: current main 67672dc5b, Linux aarch64.

auto parser = build_peg_parser([](common_peg_parser_builder & p) {
    return p.until("\"");
});
common_peg_parse_context ctx("no closing quote anywhere in here");
auto result = parser.parse(ctx);

Observed: result.success() is true; the added regression assertion expecting false fails. This can let a truncated Gemma 4 tool argument pass the final parse.

common_peg_until_parser::operator() returns NEED_MORE_INPUT at EOF only in lenient mode, then falls through to SUCCESS in final mode. The behavior dates to the PEG combinator introduction in 0a8026e768.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingserver

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions