eclipse-theia/theia

regex search crashes tab on non-fixed-width lookbehind

Open

#7,196 opened on Feb 22, 2020

View on GitHub
 (1 comment) (0 reactions) (0 assignees)TypeScript (18,676 stars) (2,478 forks)batch import
bughelp wantedsearch in workspace

Description

Description

Theia's Editor search with regex feature breaks on variable-width lookbehind and crashes the browser tab with it

Reproduction Steps

Create a file with the following string def test_function(test='ing'):

Bring up the search feature of the Editor (ctrl/cmd+f), and select the Use Regular Expression setting

Paste the following regex: (?<=def .*?\([^=]*)=

Observe the browser tab crashing

OS and Theia version: Backend Ubuntu 18.04 running the current docker theiaide/theia: sha256:fe271369304ab765a61162fd512bc150403a366348e516a4e7895c7317d6531e Frontend via Chrome 80.0.3987.116 on Windows 10

Diagnostics: When performing the equivalent operation in python3, an error is raised informing that look-behind requires fixed-width pattern. Reproduce with:

re.search("(?<=def .*?\([^=]*)=", "def test_function(test='ing'):")

This suggests that maybe a requirement for fixed-width lookbehind (and probably lookaheads..) is not properly raising an error and being translated into a non-crashing GUI representation of the error in the browser, such as a little red error box saying Invalid regular expression: look-behind requires fixed-width pattern (like the little red box that appears when trying to search for the following regular expression x( which says Invalid regular expression ... unterminated group)

Contributor guide

regex search crashes tab on non-fixed-width lookbehind · eclipse-theia/theia#7196 | Good First Issue