NetBSD Problem Report #58862
From www@netbsd.org Fri Nov 29 21:29:53 2024
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id CFEF31A9238
for <gnats-bugs@gnats.NetBSD.org>; Fri, 29 Nov 2024 21:29:53 +0000 (UTC)
Message-Id: <20241129212952.6C4621A923E@mollari.NetBSD.org>
Date: Fri, 29 Nov 2024 21:29:52 +0000 (UTC)
From: aran@100acres.us
Reply-To: aran@100acres.us
To: gnats-bugs@NetBSD.org
Subject: Backgammon causes a segfault with a terminal narrower than 72 columns.
X-Send-Pr-Version: www-1.0
>Number: 58862
>Category: bin
>Synopsis: Backgammon causes a segfault with a terminal narrower than 72 columns.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Nov 29 21:30:00 +0000 2024
>Closed-Date: Fri Nov 29 21:51:02 +0000 2024
>Last-Modified: Fri Nov 29 21:51:02 +0000 2024
>Originator: Aran Clauson
>Release: 10.99.10
>Organization:
None
>Environment:
NetBSD owl 10.99.10 NetBSD 10.99.10 (OWL) #0: Mon Jun 17 17:52:11 PDT 2024 root@owl:/root/obj/sys/arch/amd64/compile/OWL amd64
>Description:
Backgammon segfaults with a narrow terminal. With a narrow terminal, less than 72 columns, the game will default to a scrolling interface. However, the detection of narrow terminals is inconsistently communicated to the clear function in common_source/fancy.c. This causes the clear function to mistakenly assume that linect is initialize.
>How-To-Repeat:
Narrower the terminal to less than 72 columns, launch backgammon, type n for the rules, no for instructions, and w or r for your piece color.
>Fix:
Index: fancy.c
===================================================================
RCS file: /cvsroot/src/games/backgammon/common_source/fancy.c,v
retrieving revision 1.19
diff -u -r1.19 fancy.c
--- fancy.c 22 Aug 2024 20:46:40 -0000 1.19
+++ fancy.c 29 Nov 2024 21:29:18 -0000
@@ -748,8 +748,10 @@
lUP = (int)strlen(UP);
if (ND)
lND = (int)strlen(ND);
- if (LI < 24 || CO < 72 || !(CL && UP && ND))
+ if (LI < 24 || CO < 72 || !(CL && UP && ND)) {
+ CL = NULL;
return (0);
+ }
linect = (int *) calloc(LI + 1, sizeof(int));
if (linect == NULL) {
write(2, "\r\nOut of memory!\r\n", 18);
>Release-Note:
>Audit-Trail:
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/58862 CVS commit: src/games/backgammon/common_source
Date: Fri, 29 Nov 2024 21:48:45 +0000
Module Name: src
Committed By: dholland
Date: Fri Nov 29 21:48:45 UTC 2024
Modified Files:
src/games/backgammon/common_source: fancy.c
Log Message:
backgammon: fix crash on small terminals. From Aran Clauson.
(add a small tidyup from me as well)
Closes PR 58862.
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/games/backgammon/common_source/fancy.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 29 Nov 2024 21:51:02 +0000
State-Changed-Why:
fixed, thanks
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.