Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-134873: Fix a DOS issue in idlelib#134874
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
johnzhou721 wants to merge14 commits intopython:mainChoose a base branch fromjohnzhou721:idledos
base:main
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
+38 −11
Open
Changes fromall commits
Commits
Show all changes
14 commits Select commitHold shift + click to select a range
e5f4260
fix a dos
johnzhou721aa5b5a8
📜🤖 Added by blurb_it.
blurb-it[bot]edfa904
Update Misc/NEWS.d/next/Security/2025-05-29-03-24-18.gh-issue-134873.…
johnzhou7212090baf
another dos and also simplify
johnzhou721d2838a5
grumble
johnzhou72183bafff
have condition
johnzhou721660fbd3
significant refactor
johnzhou72115f821a
Update Lib/idlelib/editor.py
johnzhou7216a59e50
rem blank line
johnzhou721546f19b
write some tests
johnzhou721605373b
static
johnzhou7219625fcc
linter
johnzhou721d0017b6
get this right
johnzhou72188c318c
write more tests
johnzhou721File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1203,10 +1203,7 @@ def load_extension(self, name): | ||
self.apply_bindings(keydefs) | ||
for vevent in keydefs: | ||
methodname = vevent.replace("-", "_") | ||
johnzhou721 marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
methodname = methodname.lstrip('<').rstrip('>') | ||
methodname = methodname + "_event" | ||
if hasattr(ins, methodname): | ||
self.text.bind(vevent, getattr(ins, methodname)) | ||
@@ -1341,6 +1338,24 @@ def set_indentation_params(self, is_py_src, guess=True): | ||
self.usetabs = False | ||
self.set_tk_tabwidth(self.tabwidth) | ||
def delete_trail_whitespace(self, want, chars, tabwidth): | ||
current_pos = 0 | ||
ncharsretained = 0 | ||
for char in chars: | ||
if char == '\t': | ||
current_pos = (current_pos // tabwidth + 1) * tabwidth | ||
else: | ||
current_pos += 1 | ||
ncharsretained += 1 | ||
if current_pos > want: | ||
ncharsretained -= 1 | ||
break | ||
for i in range(ncharsretained, len(chars)): | ||
if chars[i] not in " \t": | ||
ncharsretained = i + 1 | ||
chars = chars[:ncharsretained] | ||
return len(chars) - ncharsretained, chars | ||
def smart_backspace_event(self, event): | ||
text = self.text | ||
first, last = self.get_selection_indices() | ||
@@ -1369,13 +1384,7 @@ def smart_backspace_event(self, event): | ||
assert have > 0 | ||
want = ((have - 1) // self.indentwidth) * self.indentwidth | ||
# Debug prompt is multilined.... | ||
picnixz marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
ncharsdeleted, chars = self.delete_trail_whitespace(want, chars, tabwidth) | ||
text.undo_block_start() | ||
text.delete("insert-%dc" % ncharsdeleted, "insert") | ||
if have < want: | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletionsMisc/NEWS.d/next/Security/2025-05-29-03-24-18.gh-issue-134873.dziqkQ.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix a DOS vulnerability in :mod:`idlelib` regarding string slicing. |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.