Skip to content

Failed regular expression searches can mark whole file as search result #9565

@Uhf7

Description

@Uhf7

Description of the Issue

If a regular expression search fails because of an internal stack overflow or a similar exception, the whole file is marked as search result.

Steps to Reproduce the Issue

  1. Open the text file contained in this zip: BackslashK-Testfile.zip
  2. Search for the regular expression in line 2 of the test file: abc(.|\R)*?\Kdef, easiest with wrap around option on.
  3. Repeat the search, easiest with F3.

Expected Behavior

  • All occurrences of def, which are preceded by an abc, are found step-by-step.
  • Edit 1: If the search fails, then it should not select the whole file.

Actual Behavior

  • Edit 2: Not all occurrences of def, which are preceded by an abc, are found step-by-step.
  • The def occurrences are found only as long as the distance between abc and def is shorter than 22000 to 64000 characters. An exact number cannot be given, because the internal error which occurs here is a stack overflow.
  • If the distance between abc and def is too long, then the whole file is selected as search result. Edit 3: This is dangerous, especially for replace operations.

Debug Information

Notepad++ v7.9.3 (32-bit)
Build time : Feb 14 2021 - 03:12:31
Path : C:\Tools\Npp\Npp_793\notepad++.exe
Admin mode : OFF
Local Conf mode : ON
OS Name : Windows 10 Pro (64-bit)
OS Version : 1607
OS Build : 14393.576
Current ANSI codepage : 1252
Plugins : mimeTools.dll NppConverter.dll NppExport.dll

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions