Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6299c88

Browse filesBrowse files
authored
Merge pull request #14477 from meeseeksmachine/auto-backport-of-pr-14461-on-v3.1.x
Backport PR #14461 on branch v3.1.x (Fix out of bounds read in backend_tk.)
2 parents a983c89 + daa153f commit 6299c88
Copy full SHA for 6299c88

File tree

Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed

‎lib/matplotlib/backends/_backend_tk.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/_backend_tk.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ def blit(photoimage, aggimage, offsets, bbox=None):
7171
dataptr = (height, width, data.ctypes.data)
7272
if bbox is not None:
7373
(x1, y1), (x2, y2) = bbox.__array__()
74-
bboxptr = (math.floor(x1), math.ceil(x2),
75-
math.floor(y1), math.ceil(y2))
74+
x1 = max(math.floor(x1), 0)
75+
x2 = min(math.ceil(x2), width)
76+
y1 = max(math.floor(y1), 0)
77+
y2 = min(math.ceil(y2), height)
78+
bboxptr = (x1, x2, y1, y2)
7679
else:
7780
photoimage.blank()
7881
bboxptr = (0, width, 0, height)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.