Skip to content

Misc. bug: invalid regex grammar causes segment violation #13390

Open
@rick-github

Description

@rick-github

Name and Version

$ build/bin/llama-cli --version
version: 5316 (ee01d71)
built with cc (Ubuntu 13.2.0-23ubuntu4) 13.2.0 for x86_64-linux-gnu

Operating systems

Linux

Which llama.cpp modules do you know to be affected?

llama-cli

Command line

build/bin/llama-cli -m tmp/mnt/models/quantize/gemma-1.1-2b-it.Q8_0.gguf  --no-display-prompt  -p "2+2?" -no-cnv -j '{"type":"string","pattern":"^?[0-9]$"}'

Problem description & steps to reproduce

A regex pattern that uses [*+?] without a preceding element crashes with a segment violation. This includes syntactically correct regexes that would otherwise emit "Unsupported pattern syntax" warnings, eg (?:a|b).

First Bad Commit

55b2d08

Relevant log output

$ build/bin/llama-cli -m tmp/mnt/models/quantize/gemma-1.1-2b-it.Q8_0.gguf  --no-display-prompt  -p "2+2?" -no-cnv -j '{"type":"string","pattern":"^?[0-9]$"}'
Segmentation fault (core dumped)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions