-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-110365: Fix error overwrite in termios.tcsetattr
#110366
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See also the loop below. The result of PyLong_AsLong()
is not checked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.exe After: >>> 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.tpsetattr
does rewrite errors #110365