[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] fix infocmp/tic hang
From: |
Emanuele Giaquinta |
Subject: |
Re: [PATCH] fix infocmp/tic hang |
Date: |
Fri, 23 Jun 2017 09:14:47 +0300 |
User-agent: |
Mutt/1.8.3+3 (35fba390b1f3) (2017-05-23) |
On Thu, Jun 22, 2017 at 09:00:30PM -0400, Thomas Dickey wrote:
> On Thu, Jun 22, 2017 at 11:48:31PM +0300, Emanuele Giaquinta wrote:
> > Hello,
> >
> > starting with ncurses-6.0-20170506, infocmp and tic -c hang with
> > terminal descriptions specifying pairs#7744. The problem is that
> > dump_entry.c:number_format does not terminate if the input number
> > does not belong to any of the tested intervals, because the
> > expression (mm = (1UL << nn)) never becomes zero. The behaviour is
> > undefined for nn equal to 32 (or 64), and on x86 the SHL instruction
> > considers only the lowest 5 (or 6) bits of the shift count so the
> > expression wraps to 1. The attached patch fixes the issue.
>
> that's odd: your explanation sounds reasonable, since (I see...) that
> it's been a couple of months since I'd built with 32-bit Linux.
> Mostly (aside from Solaris), it's been 64-bit configurations.
I forgot to specify that I reproduced the problem on OS X 10.11
(64-bit, clang compiler) and also on debian-9 64-bit with gcc-6.3 -O1.
With gcc-6.3 -O2 the binaries do not hang, because gcc inserts a guard
for the case of count equal to 64:
salq %cl, %rax # nn, mm
cmpl $64, %ecx #, nn
Emanuele