NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/55454: wredrawln() in libcurses does not follow the sensible behaviour



>Number:         55454
>Category:       lib
>Synopsis:       wredrawln() in libcurses does not follow the sensible behaviour
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 03 18:00:00 +0000 2020
>Originator:     Naman Jain
>Release:        NetBSD 9.0
>Organization:
IIT Kanpur
>Environment:
NetBSD localhost 9.0 NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
The behavior in case (beg_line + num_lines) exceeds LINES(win->maxy) in xcurses/wredrawln (https://pubs.opengroup.org/onlinepubs/7908799/xcurses/redrawwin.html).

Though not explicitly mentioned, I the sensible behavior is to only mark the lines after beg_line till the end of the window. (ncurses does this)

Current NetBSD curses implementation marks last num_lines, i.e [LINES-num_lines, LINES) in this case.

This change also makes sense as for a window with win->maxy = 5, beg_line = 2 and num_lines = 8 gives segmentation fault, using the proposed behavior not only we be more reasonable but also protecting against the seg fault.  
>How-To-Repeat:

>Fix:
There is a quick short fix to this. Instead of setting 
line = win->maxy - n; 
we should set
n = win->maxy - line;
https://github.com/NetBSD/src/blob/trunk/lib/libcurses/touchwin.c#L180



Home | Main Index | Thread Index | Old Index