NetBSD Problem Report #55454

From  Fri Jul  3 17:59:48 2020
Return-Path: <>
Received: from ( [])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id DC8671A9217
	for <>; Fri,  3 Jul 2020 17:59:47 +0000 (UTC)
Message-Id: <>
Date: Fri,  3 Jul 2020 17:59:46 +0000 (UTC)
Subject: wredrawln() in libcurses does not follow the sensible behaviour
X-Send-Pr-Version: www-1.0

>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
>Last-Modified:  Fri Jul 03 23:30:02 +0000 2020
>Originator:     Naman Jain
>Release:        NetBSD 9.0
IIT Kanpur
NetBSD localhost 9.0 NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020 amd64

The behavior in case (beg_line + num_lines) exceeds LINES(win->maxy)
in xcurses/wredrawln

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.


There is a quick short fix to this. Instead of setting 
line = win->maxy - n; 
we should set
n = win->maxy - line;



From: "Valeriy E. Ushakov" <>
Subject: PR/55454 CVS commit: src/lib/libcurses
Date: Fri, 3 Jul 2020 23:28:51 +0000

 Module Name:	src
 Committed By:	uwe
 Date:		Fri Jul  3 23:28:51 UTC 2020

 Modified Files:
 	src/lib/libcurses: touchwin.c

 Log Message:
 wtouchln - verify/clip input parameters
 From Naman Jain in PR lib/55454

 To generate a diff of this commit:
 cvs rdiff -u -r1.31 -r1.32 src/lib/libcurses/touchwin.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.


NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.