NetBSD Problem Report #57050

From adrian@mx.aik.onl  Sat Oct  8 19:41:21 2022
Return-Path: <adrian@mx.aik.onl>
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))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D2ACB1A923D
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  8 Oct 2022 19:41:20 +0000 (UTC)
Message-Id: <20221008175558.E1DDD2721D@www3.kiess.onl>
Date: Sat,  8 Oct 2022 19:55:58 +0200 (CEST)
From: adrian@mx.aik.onl
Reply-To: adrian@kiess.onl
To: gnats-bugs@NetBSD.org
Subject: profanity 12.1 from pkgsrc binaries on NetBSD 9.3/amd64 crashes at login 
X-Send-Pr-Version: 3.95

>Number:         57050
>Category:       pkg
>Synopsis:       profanity 12.1 crashes at login procedure
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    blymn
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 08 19:45:00 +0000 2022
>Closed-Date:    Tue Nov 08 21:18:17 +0000 2022
>Last-Modified:  Tue Nov 08 21:18:17 +0000 2022
>Originator:     Adrian Immanuel Kiess
>Release:        NetBSD 9.3
>Organization:
	KIESS.ONL
>Environment:


System: NetBSD www3.kiess.onl 9.3 NetBSD 9.3 (GENERIC) #0: Thu Aug 4 15:30:37 UTC 2022 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
  Dear maintainer,
	using NetBSD 9.3 and the current pkgsrc binaries for amd64, profanity 12.1 crashes when the applciation tries to login into an XMPP account.
	I tried with two accounts on the same server, and it appeared with both accounts.
	Using profanity 13.0 on FreeBSD, this problem does not happen and profanity works fine with above XMPP accounts.
  Also, the XMPP accounts I was using, work fine with mcabber on NetBSD and Gajim on Debian Linux.
	Here the gdb backtrace:
(gdb) bt
#0  0x000070a943217de9 in ?? () from /usr/lib/libcurses.so.8
#1  0x00000001b547e356 in ?? ()
#2  0x00000001b547bad6 in ?? ()
#3  0x00000001b547b85f in rosterwin_roster ()
#4  0x00000001b5460b66 in sv_ev_incoming_message ()
#5  0x00000001b544fc92 in ?? ()
#6  0x00000001b544d303 in ?? ()
#7  0x000070a942e1006b in ?? () from /usr/pkg/lib/libstrophe.so.0
#8  0x000070a942e0da91 in ?? () from /usr/pkg/lib/libstrophe.so.0
#9  0x000070a942e1bb6b in ?? () from /usr/pkg/lib/libstrophe.so.0
#10 0x000070a94200a177 in ?? () from /usr/lib/libexpat.so.2
#11 0x000070a94200ae34 in ?? () from /usr/lib/libexpat.so.2
#12 0x000070a94200d17a in XML_ParseBuffer () from /usr/lib/libexpat.so.2
#13 0x000070a942e0f91d in xmpp_run_once () from /usr/pkg/lib/libstrophe.so.0
#14 0x00000001b5444033 in connection_check_events ()
#15 0x00000001b54431fd in session_process_events ()
#16 0x00000001b543c64b in prof_run ()
#17 0x00000001b54de7cc in main ()

  Thank you very much, for your kind attention.

  Sincerely,

  Adrian Kiess

>How-To-Repeat:
  $ profanity & and login to an existing account. While the login procedure is happening, profanity crashes.
>Fix:
  No fix is known to me.

>Release-Note:

>Audit-Trail:
From: Harold Gutch <logix@foobar.franken.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/57050: profanity 12.1 from pkgsrc binaries on NetBSD 9.3/amd64 crashes at login
Date: Tue, 11 Oct 2022 18:58:29 +0200

 --ZfOjI3PrQbgiZnxM
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 Hi,

 based on the stacktrace this seems to be crashing in curses'
 wattron(), namely in

         const TERMINAL *t = win->screen->term;

 I believe this is coming from profanity's src/ui/rosterwin.c which in
 l. 1072 calls

     wattron(layout->subwin, theme_attrs(THEME_ROSTER_HEADER));

 and it seems that the first parameter here is NULL.  The code in
 question here handles messages by people not in the user's contact
 list, and what is probably happening is that the xmpp server is
 sending such a message before profanity has set up its window layout.
 Setting roster.unsubscribed=false indeed makes profanity start
 without crashing, and the attached patch bails out early in the
 problematic code path if layout->subwin is NULL (Adrian verified for
 me that either of the two makes profanity work for him again).  But I
 am not familiar enough with the profanity code to say if this has any
 issus...

 FreeBSD doesn't crash here in ncurses because FreeBSD's wattron() has
 a check if the first parameter is NULL, in which case it just returns
 an error, and we could do the same.  On the other hand, ultimately
 this is a bug in profanity and we just noticed *because* we don't mask
 it in curses.


   Harold

 --ZfOjI3PrQbgiZnxM
 Content-Type: text/x-csrc; charset=us-ascii
 Content-Disposition: attachment; filename="patch-src_ui_rosterwin.c"

 --- src/ui/rosterwin.c.orig	2022-05-29 16:45:24.000000000 +0200
 +++ src/ui/rosterwin.c	2022-10-11 13:45:23.394512000 +0200
 @@ -98,10 +98,12 @@
      ProfLayoutSplit* layout = (ProfLayoutSplit*)console->layout;
      assert(layout->memcheck == LAYOUT_SPLIT_MEMCHECK);

 -    if (layout->subwin != NULL) {
 -        werase(layout->subwin);
 +    if (layout->subwin == NULL) {
 +        return;
      }

 +    werase(layout->subwin);
 +
      char* roomspos = prefs_get_string(PREF_ROSTER_ROOMS_POS);
      if (prefs_get_boolean(PREF_ROSTER_ROOMS) && (g_strcmp0(roomspos, "first") == 0)) {
          _rosterwin_print_rooms(layout);

 --ZfOjI3PrQbgiZnxM--

Responsible-Changed-From-To: pkg-manager->blymn
Responsible-Changed-By: blymn@NetBSD.org
Responsible-Changed-When: Tue, 08 Nov 2022 21:18:17 +0000
Responsible-Changed-Why:
I will claim this one


State-Changed-From-To: open->closed
State-Changed-By: blymn@NetBSD.org
State-Changed-When: Tue, 08 Nov 2022 21:18:17 +0000
State-Changed-Why:
Closing, added checks that will prevent this crash.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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-2022 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.