[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: libtasn1-4.9 ctype issue
From: |
Thomas Klausner |
Subject: |
Re: libtasn1-4.9 ctype issue |
Date: |
Tue, 17 Jan 2017 09:55:21 +0100 |
On Mon, Jan 16, 2017 at 07:33:31PM +0100, Nikos Mavrogiannopoulos wrote:
> On Mon, 2017-01-16 at 02:24 +0100, Thomas Klausner wrote:
> > Hi!
> >
> > Compilation of libtasn1 on NetBSD fails with the default setting of
> > -Werror because of:
> >
> > ASN1.y: In function '_asn1_yylex':
> > ASN1.y:578:9: error: array subscript has type 'char' [-Werror=char-
> > subscripts]
> > if (!isdigit (string[k]))
> > ^
> >
> > NetBSD is pickier with ctype macros than most other operating
> > systems.
>
> Hi,
> I do not see the issue. 'k' is defined as integer. If it is an issue
> with the netbsd compiler please provide a patch to address it.
The problem is not with k, but with the argument of "isdigit", which
is "string[k]". That's defined as char, not unsigned char.
The standard solution is to cast it to (unsigned char), see attached
patch, since it was already checked that it can't be -1 when we get
here.
Cheers,
Thomas
patch-lib_ASN1.y
Description: Text document