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 module may call delwin() on original window before subwindows
Type: crash Stage: patch review
Components: Extension Modules Versions: Python 3.11, Python 3.10, Python 3.9, Python 3.8, Python 3.7, Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: michaelforney
Priority: normal Keywords: patch

Created on 2021-05-19 02:08 by michaelforney, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 26226 open michaelforney, 2021-05-19 02:24
Messages (1)
msg393916 - (view) Author: Michael Forney (michaelforney) * Date: 2021-05-19 02:08
When subwin() is used to create a subwindow for an original window, it does not keep a reference to the original window object. This can result in the original window getting deleted with delwin() before the subwindow.

According to the X/Open curses specification[0]:
> The application must delete subwindows before deleting the main window.

This is also mentioned in the ncurses documentation[1]:
> Subwindows must be deleted before the main window can be deleted.

When building the Python curses module against NetBSD's curses implementation, deleting the windows in the wrong order causes a double-free. This results in hanging or crashing when running test_curses.

To fix this, window objects for subwindows should keep a reference to the original window object.

[0] https://pubs.opengroup.org/onlinepubs/7908799/xcurses/delwin.html
[1] https://invisible-island.net/ncurses/man/curs_window.3x.html
History
Date User Action Args
2022-04-11 14:59:45adminsetgithub: 88338
2021-05-19 02:24:53michaelforneysetkeywords: + patch
stage: patch review
pull_requests: + pull_request24843
2021-05-19 02:08:10michaelforneycreate