Date: Tue, 17 Feb 2004 10:11:05 -0800 From: Tim Kientzle <kientzle@acm.org> To: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz> Cc: freebsd-hackers@freebsd.org Subject: Re: signed char bug in regexp library Message-ID: <40325939.6000104@acm.org> In-Reply-To: <Pine.LNX.4.58.0402162039280.18066@artax.karlin.mff.cuni.cz> References: <Pine.LNX.4.58.0402162039280.18066@artax.karlin.mff.cuni.cz>
next in thread | previous in thread | raw e-mail | index | archive | help
Mikulas Patocka wrote: > Hi > > I ripped regexp library from FreeBSD 4 and use it in another program. I > get random crashes because the library casts char to int and uses it as > array index ... the most obvious case is engine.i:189: > register char *dp; > dp += charjump[(int)*dp]; > but there are many more and I'm unable to spot them all. > > When i compile library with -funsigned-char, it works fine. But it isn't > compiled with that flag in FreeBSD. Mikulas, Could you verify that programs in FreeBSD 4 crash because of this? That would provide incentive to get it fixed. One easy fix, by the way, is: dp += charjump[(int)(unsigned char)*dp]; For what it's worth, the code probably isn't assuming unsigned characters; it's probably assuming ASCII. ;-) Tim Kientzle
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40325939.6000104>