Skip to content

gh-136061: IDLE - update code in editor.Editor.load_extension #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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e5f4260
fix a dos
johnzhou721 May 29, 2025
aa5b5a8
📜🤖 Added by blurb_it.
blurb-it[bot] May 29, 2025
edfa904
Update Misc/NEWS.d/next/Security/2025-05-29-03-24-18.gh-issue-134873.…
johnzhou721 May 30, 2025
2090baf
another dos and also simplify
johnzhou721 May 30, 2025
d2838a5
grumble
johnzhou721 May 30, 2025
83bafff
have condition
johnzhou721 May 30, 2025
660fbd3
significant refactor
johnzhou721 May 30, 2025
15f821a
Update Lib/idlelib/editor.py
johnzhou721 Jun 1, 2025
6a59e50
rem blank line
johnzhou721 Jun 1, 2025
546f19b
write some tests
johnzhou721 Jun 1, 2025
605373b
static
johnzhou721 Jun 1, 2025
9625fcc
linter
johnzhou721 Jun 1, 2025
d0017b6
get this right
johnzhou721 Jun 1, 2025
88c318c
write more tests
johnzhou721 Jun 1, 2025
6323ab8
unconditionally remove last character, tests
johnzhou721 Jun 1, 2025
01921fc
more organized testing also speedup test
johnzhou721 Jun 1, 2025
5f9bb55
grumble
johnzhou721 Jun 1, 2025
a087395
fix some tests and add some new ones
johnzhou721 Jun 1, 2025
6604a73
fix everythign
johnzhou721 Jun 1, 2025
3f0abfb
precommit
johnzhou721 Jun 1, 2025
1e9bdfd
Merge branch 'main' into idledos
johnzhou721 Jun 12, 2025
0b3c5b6
Merge branch 'main' into idledos
johnzhou721 Jun 14, 2025
338e2fc
Merge branch 'main' into idledos
johnzhou721 Jun 15, 2025
7c92d9a
Apply suggestions from code review
terryjreedy Jun 28, 2025
e1fb6b9
Apply suggestions from code review
terryjreedy Jun 28, 2025
7b67419
Update Lib/idlelib/idle_test/test_editor.py
terryjreedy Jun 28, 2025
1037bea
Delete Misc/NEWS.d/next/Security/2025-05-29-03-24-18.gh-issue-134873.…
terryjreedy Jun 28, 2025
e505938
📜🤖 Added by blurb_it.
blurb-it[bot] Jun 28, 2025
283a27a
Apply suggestions from code review
johnzhou721 Jun 29, 2025
d58bd18
update news
johnzhou721 Jun 29, 2025
560e06b
Update News3.txt
johnzhou721 Jun 29, 2025
a09c458
Delete Misc/NEWS.d/next/IDLE/2025-06-28-13-29-52.gh-issue-136061.EQYu…
johnzhou721 Jun 30, 2025
a082fbf
Update Lib/idlelib/News3.txt
johnzhou721 Jun 30, 2025
4c1268f
Update Lib/idlelib/editor.py
johnzhou721 Jun 30, 2025
ab8ef90
Merge branch 'main' into idledos
johnzhou721 Jul 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions Lib/idlelib/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1203,10 +1203,7 @@ def load_extension(self, name):
self.apply_bindings(keydefs)
for vevent in keydefs:
methodname = vevent.replace("-", "_")
while methodname[:1] == '<':
methodname = methodname[1:]
while methodname[-1:] == '>':
methodname = methodname[:-1]
methodname = methodname.lstrip('<').rstrip('>')
methodname = methodname + "_event"
if hasattr(ins, methodname):
self.text.bind(vevent, getattr(ins, methodname))
Expand Down Expand Up @@ -1370,12 +1367,18 @@ def smart_backspace_event(self, event):
want = ((have - 1) // self.indentwidth) * self.indentwidth
# Debug prompt is multilined....
ncharsdeleted = 0
while True:
chars = chars[:-1]
ncharsdeleted = ncharsdeleted + 1
have = len(chars.expandtabs(tabwidth))
if have <= want or chars[-1] not in " \t":
have = len(chars.expandtabs(tabwidth))
for i in range(len(chars) - 1, -1, -1):
# ``Delete'' chars[i], and subtract count
# (since redoing expandtabs is O(n))
ncharsdeleted += 1
if chars[i] == '\t':
have -= tabwidth
else:
have -= 1
if have <= want or chars[i-1] not in " \t":
break
chars = chars[:len(chars) - ncharsdeleted]
text.undo_block_start()
text.delete("insert-%dc" % ncharsdeleted, "insert")
if have < want:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a DOS vulnerability in :mod:`idlelib` regarding string slicing.
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy