mirror of
https://github.com/python/cpython.git
synced 2025-08-19 08:11:46 +00:00
#4317: Fix an Array Bounds Read in imageop.rgb2rgb8.
Backport of r67266
This commit is contained in:
parent
42fe1a2ff8
commit
ef633d7c5d
3 changed files with 5 additions and 2 deletions
|
@ -19,6 +19,7 @@ SIZES = (1, 2, 3, 4)
|
|||
_VALUES = (1, 2, 2**10, 2**15-1, 2**15, 2**15+1, 2**31-2, 2**31-1)
|
||||
VALUES = tuple( -x for x in reversed(_VALUES) ) + (0,) + _VALUES
|
||||
AAAAA = "A" * 1024
|
||||
MAX_LEN = 2**20
|
||||
|
||||
|
||||
class InputValidationTests(unittest.TestCase):
|
||||
|
@ -30,7 +31,7 @@ class InputValidationTests(unittest.TestCase):
|
|||
strlen = abs(width * height)
|
||||
if size:
|
||||
strlen *= size
|
||||
if strlen < 1024:
|
||||
if strlen < MAX_LEN:
|
||||
data = "A" * strlen
|
||||
else:
|
||||
data = AAAAA
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue