mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #15989: Fix several occurrences of integer overflow
when result of PyLong_AsLong() narrowed to int without checks. This is a backport of changesets 13e2e44db99d and 525407d89277.
This commit is contained in:
parent
ff12fae80e
commit
441d30fac7
16 changed files with 129 additions and 20 deletions
|
@ -1,6 +1,7 @@
|
|||
# Test case for the os.poll() function
|
||||
|
||||
import os, select, random, unittest
|
||||
import _testcapi
|
||||
from test.support import TESTFN, run_unittest
|
||||
|
||||
try:
|
||||
|
@ -150,6 +151,15 @@ class PollTests(unittest.TestCase):
|
|||
if x != 5:
|
||||
self.fail('Overflow must have occurred')
|
||||
|
||||
pollster = select.poll()
|
||||
# Issue 15989
|
||||
self.assertRaises(OverflowError, pollster.register, 0,
|
||||
_testcapi.SHRT_MAX + 1)
|
||||
self.assertRaises(OverflowError, pollster.register, 0,
|
||||
_testcapi.USHRT_MAX + 1)
|
||||
self.assertRaises(OverflowError, pollster.poll, _testcapi.INT_MAX + 1)
|
||||
self.assertRaises(OverflowError, pollster.poll, _testcapi.UINT_MAX + 1)
|
||||
|
||||
def test_main():
|
||||
run_unittest(PollTests)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue