-
Notifications
You must be signed in to change notification settings - Fork 203
Open
Description
Hi there,
I've been fixing my implementation of resize for my game and noticed that if you call wresize with a window that doesn't fit within SP->lines and SP->cols it doesn't return ERR. This was a problem for me because my program would call wtouchwin immediately after and segfault.
I took a look at newwin and it has protection against this case, but wresize does not.
Lines 276 to 277 in 5c62af0
| if (!SP || begy + nlines > SP->lines || begx + ncols > SP->cols) | |
| return (WINDOW *)NULL; |
For my program I wrote a dumb little wrapper around wresize that performs the check:
int
wresize_wrapper(WINDOW *win, int nlines, int ncols) noexcept
{
// THIS WAS COPIED FROM newwin
if (!SP || win->_begy + nlines > SP->lines || win->_begx + ncols > SP->cols)
return ERR;
return ::wresize(win, nlines, ncols);
}- Do you agree that not having this check is a problem?
- Would you be open to having this fixed?
Thank you so much for your time.
Metadata
Metadata
Assignees
Labels
No labels