eclipse-theia/theia

regex search crashes tab on non-fixed-width lookbehind

Open

#7,196 创建于 2020年2月22日

在 GitHub 查看
 (1 评论) (0 反应) (0 负责人)TypeScript (18,676 star) (2,478 fork)batch import
bughelp wantedsearch in workspace

描述

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)

贡献者指南