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: curses: calling addch() with an 1-length str segfaults with ncurses6 compiled with --enable-ext-colors
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: python-dev, serhiy.storchaka, twouters, yyt16384
Priority: normal Keywords: patch

Created on 2016-10-28 17:51 by yyt16384, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
curses_setcchar.patch serhiy.storchaka, 2016-10-28 20:56 review
curses_setcchar_2.patch serhiy.storchaka, 2016-10-29 07:21 review
Pull Requests
URL Status Linked Edit
PR 552 closed dstufft, 2017-03-31 16:36
Messages (7)
msg279620 - (view) Author: Yutao Yuan (yyt16384) Date: 2016-10-28 17:51
When addch() is called with an 1-length str, it is converted into a cchar_t. Ncurses6 adds a new field ext_color to cchar_t if it is enabled at compile time, and it is not initialized here, which causes various problems like segfaults or wrong display of characters.
msg279627 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-28 20:56
The _curses module uses direct access to cchar_t fields. Proposed patch makes it using setcchar. Does it fixes this issue Yutao?
msg279644 - (view) Author: Yutao Yuan (yyt16384) Date: 2016-10-29 02:12
It fails to compile for me. setcchar should take a cchar_t* and a const wchar_t* instead.
msg279660 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-29 07:21
Ah, sorry. libncursesw5-dev was not installed on my computer.

Please try updated patch.
msg279678 - (view) Author: Yutao Yuan (yyt16384) Date: 2016-10-29 15:09
Yes, it works for me now.
msg279747 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-10-30 20:54
New changeset d06bf822585c by Serhiy Storchaka in branch '3.5':
Issue #28549: Fixed segfault in curses's addch() with ncurses6.
https://hg.python.org/cpython/rev/d06bf822585c

New changeset 382b3d19e9fc by Serhiy Storchaka in branch '3.6':
Issue #28549: Fixed segfault in curses's addch() with ncurses6.
https://hg.python.org/cpython/rev/382b3d19e9fc

New changeset 11cb97de3edd by Serhiy Storchaka in branch 'default':
Issue #28549: Fixed segfault in curses's addch() with ncurses6.
https://hg.python.org/cpython/rev/11cb97de3edd
msg279750 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-30 21:02
Thank you for testing this.
History
Date User Action Args
2022-04-11 14:58:38adminsetgithub: 72735
2017-03-31 16:36:30dstufftsetpull_requests: + pull_request1035
2016-10-30 21:02:55serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg279750

stage: patch review -> resolved
2016-10-30 20:54:40python-devsetnosy: + python-dev
messages: + msg279747
2016-10-30 20:53:37serhiy.storchakasetassignee: serhiy.storchaka
2016-10-29 15:09:32yyt16384setmessages: + msg279678
2016-10-29 07:21:01serhiy.storchakasetfiles: + curses_setcchar_2.patch

messages: + msg279660
2016-10-29 02:12:47yyt16384setmessages: + msg279644
2016-10-28 20:56:45serhiy.storchakasetfiles: + curses_setcchar.patch

versions: + Python 3.6, Python 3.7, - Python 3.4
keywords: + patch
nosy: + serhiy.storchaka, twouters

messages: + msg279627
stage: patch review
2016-10-28 17:51:09yyt16384create