Skip to content

Guard search_meta against invalid regex - #2428

Merged
UlrichB22 merged 1 commit into
moinwiki:masterfrom
rikvanriel:fix-indexing-regex-crash
Nov 10, 2026
Merged

UlrichB22 merged 1 commit into
moinwiki:masterfrom
rikvanriel:fix-indexing-regex-crash

Conversation

@rikvanriel

Copy link
Copy Markdown
Contributor

Guard search_meta against invalid regex

ItemList pre-validates its regex argument and renders an error box,
but search_meta/get_index accept a pattern from any caller -- a
plugin or out-of-tree macro -- and re.compile raises re.error from
inside the searcher context on a pattern that does not compile.

Catch re.error and yield no hits on invalid input, matching the
filter semantics of the call. A regression test pins the empty
result for a pattern that does not compile ("[[[", unterminated
character set) plus a compiling-pattern control that still matches.

ItemList pre-validates its regex argument and renders an error box,
but search_meta/get_index accept a pattern from any caller -- a
plugin or out-of-tree macro -- and re.compile raises re.error from
inside the searcher context on a pattern that does not compile.

Catch re.error and yield no hits on invalid input, matching the
filter semantics of the call. A regression test pins the empty
result for a pattern that does not compile ("[[[", unterminated
character set) plus a compiling-pattern control that still matches.
@UlrichB22
UlrichB22 merged commit ab77837 into moinwiki:master Nov 10, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants