New submission from Serhiy Storchaka: 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.
---------- assignee: serhiy.storchaka components: Extension Modules files: curses-PyUnicode_AsEncodedString.patch keywords: patch messages: 279377 nosy: serhiy.storchaka, twouters priority: normal severity: normal stage: patch review status: open title: Use PyUnicode_AsEncodedString instead of PyUnicode_AsEncodedObject type: crash versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7 Added file: http://bugs.python.org/file45212/curses-PyUnicode_AsEncodedString.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28526> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com