Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Negative repeat value in Column Editor causes hang #15153

Closed
1 task done
cddiffz opened this issue May 17, 2024 · 4 comments
Closed
1 task done

[BUG] Negative repeat value in Column Editor causes hang #15153

cddiffz opened this issue May 17, 2024 · 4 comments
Assignees

Comments

@cddiffz
Copy link
Contributor

cddiffz commented May 17, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Description of the Issue

If you try to use the Column Editor to insert numbers with a negative number pasted into the "Repeat" field, the program hangs.

Steps To Reproduce

  1. Copy -1 to the clipboard
  2. Open Column Editor, select "Number to Insert", paste -1 into the "Repeat" field
  3. Press "OK"

Current Behavior

Program stops responding

Expected Behavior

Either the repeat value is internally set to 1 (as if nothing or 0 was entered) or an error is reported.

Debug Information

Notepad++ v8.6.7   (64-bit)
Build time : May 12 2024 - 20:04:00
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line :
Admin mode : OFF
Local Conf mode : OFF
Cloud Config : OFF
Periodic Backup : ON
OS Name : Windows 10 Pro (64-bit)
OS Version : 1809
OS Build : 17763.1579
Current ANSI codepage : 1252
Plugins :
    mimeTools (3.1)
    NppConverter (4.6)
    NppExport (0.4)

Anything else?

No response

@molsonkiko
Copy link
Contributor

Looks like it can be fixed with a simple change of this line from a == comparison to a <= comparison (i.e., would become if (repeat <= 0)) would fix this problem.

molsonkiko added a commit to molsonkiko/notepad-plus-plus that referenced this issue May 20, 2024
Now 1 is the floor for the repeat value.
Probably it would be a good idea to check
     if there are similar issues elsewhere.
@molsonkiko
Copy link
Contributor

This problem is fixed in this commit, but I'm holding off on submitting a PR, because I think this issue is mainly due to a lack of understanding of what the repeat field is for.
IMO any user who understands the purpose of the repeat field would not deliberately paste in a negative number, and it's not possible to enter a negative number except by pasting, so I'm not sure this is even worth a PR. If a core dev disagrees, I'll submit the PR.
The relevant documentation is here in the user manual, and I think it's already clear enough as is, but maybe if it were clearer people wouldn't make this mistake?

@alankilborn
Copy link
Contributor

and it's not possible to enter a negative number except by pasting

Sigh. Because users apparently will try this, IMO it deserves to be prevented.

@donho
Copy link
Member

donho commented May 21, 2024

@molsonkiko
It's not about the common sense of the users, but the attack from hackers - for the sake of security, any crash should be prevented.
You can submit the PR for fixing the issue, it will be merged into the master.

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 a pull request may close this issue.

4 participants