delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/12/18/06:43:42

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
X-Authentication-Warning: acp3bf.physik.rwth-aachen.de: broeker owned process doing -bs
Date: Tue, 18 Dec 2001 12:43:07 +0100 (MET)
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
X-Sender: broeker AT acp3bf
To: djgpp-workers AT delorie DOT com
Subject: Re: regcomp NLS fix
In-Reply-To: <4890F40B.025BA7D0.09ACFA57@netscape.net>
Message-ID: <Pine.LNX.4.10.10112181223160.19385-100000@acp3bf>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, 18 Dec 2001, Alexander Aganichev wrote:

> regcomp() sometimes crashes when NLS characters are in use. This patch
> seems to fix this (though I'm not sure whether NLS characters may be a
> problem in other places):

I'm quite sure there are.  The real problem is that lots of calls of
<ctype.h> functions inside regcomp are incorrect because they pass char
values into them without casting to unsigned char first.  This would only
be correct if our libc assumed char == unsigned char, but unless I'm
totally misremembering things, the opposite is true.

Changing all calls like

	isdigit(PEEK());

to 	isdigit((unsigned char) PEEK());

should get us closer to a solution of this issue.  It may even be
necessary to re-check *all* usages of plain 'char' variables in the whole
regex directory.  I.e. it could be preferrable if the value returned by
PEEK, i.e. the "next" field of "struct parse", were an unsigned char.

Or maybe we should just see if Henry Spencer has a newer, already fixed
version of this regexp matcher published that we could use?

Compiling the regexp directory with our full usual set of warnings active
(commenting out the XGCC override in src/libc/posix/regex/makefile) should
help to point out all the problematic calls. They'll turn into warnings
"char expression used as array index" or similar.

-- 
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019