Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

gh-92888: Fix memoryview bad__index__ use after free#92946

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

Merged
Fidget-Spinner merged 12 commits intopython:mainfromFidget-Spinner:fix_memoryview_auf
Jun 17, 2022
Merged
Changes from1 commit
Commits
Show all changes
12 commits
Select commitHold shift + click to select a range
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
PrevPrevious commit
NextNext commit
Add more tests by Serhiy
Co-Authored-By: Serhiy Storchaka <3659035+serhiy-storchaka@users.noreply.github.com>
  • Loading branch information
@Fidget-Spinner@serhiy-storchaka
Fidget-Spinner andserhiy-storchaka committedMay 23, 2022
commitc818990bec7eca524a8cc6d35b859fd54f8bc303
18 changes: 18 additions & 0 deletionsLib/test/test_memoryview.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -577,6 +577,13 @@ def __bool__(self):
m = memoryview(bytearray(b'\xff'*size))
self.assertEqual(list(m[MyIndex():8]), [255] * 4)

ba = None
m = memoryview(bytearray(b'\xff'*size)).cast('B', (64, 2))
self.assertEqual(m[MyIndex(), 0], 0)
ba = None
m = memoryview(bytearray(b'\xff'*size)).cast('B', (2, 64))
self.assertEqual(m[0, MyIndex()], 0)

ba = None
m = memoryview(bytearray(b'\xff'*size))
with self.assertRaisesRegex(ValueError, "operation forbidden"):
Expand All@@ -595,6 +602,17 @@ def __bool__(self):
m[MyIndex():8] = b'spam'
self.assertEqual(ba[:8], b'\0'*8)

ba = None
m = memoryview(bytearray(b'\xff'*size)).cast('B', (64, 2))
with self.assertRaisesRegex(ValueError, "operation forbidden"):
m[MyIndex(), 0] = 42
self.assertEqual(ba[8:16], b'\0'*8)
ba = None
m = memoryview(bytearray(b'\xff'*size)).cast('B', (2, 64))
with self.assertRaisesRegex(ValueError, "operation forbidden"):
m[0, MyIndex()] = 42
self.assertEqual(ba[:8], b'\0'*8)

ba = None
m = memoryview(bytearray(b'\xff'*size))
with self.assertRaisesRegex(ValueError, "operation forbidden"):
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp