NetBSD-Bugs archive

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

Re: lib/54085: curses crash with non-ascii on bottom line



The following reply was made to PR lib/54085; it has been noted by GNATS.

From: Roy Marples <roy%marples.name@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: lib/54085: curses crash with non-ascii on bottom line
Date: Thu, 28 Mar 2019 16:58:45 +0000

 This patch should solve the issue.
 Let me know!
 
 Roy
 
 Index: refresh.c
 ===================================================================
 RCS file: /cvsroot/src/lib/libcurses/refresh.c,v
 retrieving revision 1.105
 diff -u -p -r1.105 refresh.c
 --- refresh.c   6 Jan 2019 04:27:53 -0000       1.105
 +++ refresh.c   28 Mar 2019 16:57:08 -0000
 @@ -1046,10 +1046,15 @@ putchbr(__LDATA *nsp, __LDATA *csp, __LD
           * To do this, work out their widths.
           * XXX This does not work when the bottom right corner is an 
 ACS. */
   #ifdef HAVE_WCHAR
 +       if (psp == NULL) /* Nothing to insert? */
 +               return ERR;
          cw = wcwidth(nsp->ch);
 -       pcw = psp == NULL ? 0 : wcwidth(psp->ch);
 +       pcw = wcwidth(psp->ch);
 +       /* Still need to output attributes. */
 +       if (cw < 1)
 +               cw = 1;
          if (pcw < 1)
 -               return ERR; /* Nothing to insert */
 +               pcw = 1;
 
          /* When wide characters we need something other than
           * insert_character. */
 @@ -1318,6 +1323,8 @@ makech(int wy)
 
   #ifdef HAVE_WCHAR
                          chw = wcwidth(nsp->ch);
 +                       if (chw < 1)
 +                               chw = 1; /* Still need to output 
 attributes. */
   #else
                          chw = 1;
   #endif /* HAVE_WCHAR */
 


Home | Main Index | Thread Index | Old Index