Issue 28549: curses: calling addch() with an 1-length str segfaults with ncurses6 compiled with --enable-ext-colors (original) (raw)

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:38 admin set github: 72735
2017-03-31 16:36:30 dstufft set pull_requests: + <pull%5Frequest1035>
2016-10-30 21:02:55 serhiy.storchaka set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2016-10-30 20:54:40 python-dev set nosy: + python-devmessages: +
2016-10-30 20:53:37 serhiy.storchaka set assignee: serhiy.storchaka
2016-10-29 15:09:32 yyt16384 set messages: +
2016-10-29 07:21:01 serhiy.storchaka set files: + curses_setcchar_2.patchmessages: +
2016-10-29 02:12:47 yyt16384 set messages: +
2016-10-28 20:56:45 serhiy.storchaka set files: + curses_setcchar.patchversions: + Python 3.6, Python 3.7, - Python 3.4keywords: + patchnosy: + serhiy.storchaka, twoutersmessages: + stage: patch review
2016-10-28 17:51:09 yyt16384 create