This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Use PyUnicode_AsEncodedString instead of PyUnicode_AsEncodedObject
Type: crash Stage: resolved
Components: Extension Modules Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: josh.r, python-dev, serhiy.storchaka, twouters
Priority: normal Keywords: patch

Created on 2016-10-25 08:42 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
curses-PyUnicode_AsEncodedString.patch serhiy.storchaka, 2016-10-25 08:42 review
Messages (4)
msg279377 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-25 08:42
PyUnicode_AsEncodedObject() can return an object of arbitrary type, while PyUnicode_AsEncodedString() always returns bytes. The code that uses PyUnicode_AsEncodedObject() in the _curses module expects bytes, but does not check the type of the result. This can cause undefined behavior, including a crash. Using PyUnicode_AsEncodedString() is more correct in this case.
msg279409 - (view) Author: Josh Rosenberg (josh.r) * (Python triager) Date: 2016-10-25 14:41
LGTM.
msg279547 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-10-27 16:33
New changeset bea48e72cae5 by Serhiy Storchaka in branch '3.5':
Issue #28526: Use PyUnicode_AsEncodedString() instead of
https://hg.python.org/cpython/rev/bea48e72cae5

New changeset fe9f361f3751 by Serhiy Storchaka in branch '3.6':
Issue #28526: Use PyUnicode_AsEncodedString() instead of
https://hg.python.org/cpython/rev/fe9f361f3751

New changeset a6548e230ed6 by Serhiy Storchaka in branch 'default':
Issue #28526: Use PyUnicode_AsEncodedString() instead of
https://hg.python.org/cpython/rev/a6548e230ed6
msg279548 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-27 16:34
Thank you for your review Josh.
History
Date User Action Args
2022-04-11 14:58:38adminsetgithub: 72712
2016-10-27 16:34:33serhiy.storchakasetstatus: open -> closed
versions: - Python 2.7
messages: + msg279548

resolution: fixed
stage: patch review -> resolved
2016-10-27 16:33:48python-devsetnosy: + python-dev
messages: + msg279547
2016-10-25 14:41:36josh.rsetnosy: + josh.r
messages: + msg279409
2016-10-25 08:42:57serhiy.storchakalinkissue28426 dependencies
2016-10-25 08:42:38serhiy.storchakacreate