gh-110365: Fix error overwrite in termios.tcsetattr#110366
gh-110365: Fix error overwrite in termios.tcsetattr#110366erlend-aasland merged 10 commits intopython:mainfrom
termios.tcsetattr#110366Conversation
serhiy-storchaka
left a comment
There was a problem hiding this comment.
See also the loop below. The result of PyLong_AsLong() is not checked.
serhiy-storchaka
left a comment
There was a problem hiding this comment.
See also PyLong_AsLong() in the loop below.
|
@serhiy-storchaka yes, you found one more problem, this code crashes! Before: >>> termios.tcsetattr(0, 0, [0, 1, 2, 3, 4, 5, [*range(0, 19), sys.maxsize * 10]])
Fatal Python error: _Py_CheckFunctionResult: a function returned a result with an exception set
Python runtime state: initialized
OverflowError: Python int too large to convert to C long
The above exception was the direct cause of the following exception:
SystemError: <built-in function tcsetattr> returned a result with an exception set
Current thread 0x00000001de555300 (most recent call first):
File "<stdin>", line 1 in <module>
[1] 20789 abort ./python.exeAfter: >>> import termios, sys
>>> termios.tcsetattr(0, 0, [0, 1, 2, 3, 4, 5, [*range(0, 19), sys.maxsize * 10]])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C long
>>>
KeyboardInterrupt
>>> ^D |
Misc/NEWS.d/next/Library/2023-10-04-18-56-29.gh-issue-110365.LCxiau.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Could you add this test case to the test suite? |
My suggestion was buggy, and there is no tests
Please, see my comment here: #110365 We don't have |
|
Thanks, @erlend-aasland! |
|
New issue about missing tests: #110380 |
|
Thanks @sobolevn for the PR, and @erlend-aasland for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
|
GH-110389 is a backport of this pull request to the 3.12 branch. |
|
GH-110390 is a backport of this pull request to the 3.11 branch. |
|
|
…10366) Co-authored-by: Erlend E. Aasland <erlend@python.org>
@erlend-aasland we fixed several similar errors before, would you mind to take a look?
termios.tpsetattrdoes rewrite errors #110365