From owner-cvs-src@FreeBSD.ORG Sat Aug 13 14:37:53 2005 Return-Path: X-Original-To: cvs-src@FreeBSD.ORG Delivered-To: cvs-src@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D056F16A41F; Sat, 13 Aug 2005 14:37:53 +0000 (GMT) (envelope-from tjr@freebsd.org) Received: from mail.netspace.net.au (whirlwind.netspace.net.au [203.10.110.76]) by mx1.FreeBSD.org (Postfix) with ESMTP id 703D943D45; Sat, 13 Aug 2005 14:37:53 +0000 (GMT) (envelope-from tjr@freebsd.org) Received: from [192.168.0.2] (220-253-115-10.VIC.netspace.net.au [220.253.115.10]) by mail.netspace.net.au (Postfix) with ESMTP id D3AC912D8C4; Sun, 14 Aug 2005 00:37:50 +1000 (EST) Message-ID: <42FE05C8.1080600@freebsd.org> Date: Sun, 14 Aug 2005 00:38:00 +1000 From: Tim Robbins User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andrey Chernov References: <200508130230.j7D2UGSp002570@repoman.freebsd.org> <20050813120150.GA33192@nagual.pp.ru> In-Reply-To: <20050813120150.GA33192@nagual.pp.ru> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: cvs-src@FreeBSD.ORG, src-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/lib/libc/regex regex2.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Aug 2005 14:37:54 -0000 Andrey Chernov wrote: >On Sat, Aug 13, 2005 at 02:30:16AM +0000, Tim J. Robbins wrote: > > >>tjr 2005-08-13 02:30:16 UTC >> >> FreeBSD src repository >> >> Modified files: >> lib/libc/regex regex2.h >> Log: >> Change OUT from -2 to CHAR_MIN-1, making it impossible for it to >> inadvertently match a negative char in the RE being compiled. >> >> > >It seems this commit may mask the bug where signed comparison used. >Better fix perhaps to make compared char unsigned in all places, i.e. > if (-2 == (unsigned char)'\254') > > > For whatever reason, the "stop" argument to p_ere() and the "stop1" and "stop2" arguments to p_bre() are signed chars cast to int, not unsigned chars cast to int, so OUT needs to be outside the valid range of char, not unsigned char. This is somewhat unconventional, but I don't think the new value of CHAR_MIN-1 is any worse than the pre- rev. 1.8 value of CHAR_MAX+1. The choice of -2 in rev. 1.8 was a mistake on my part caused by not realising that characters were being passed around as signed chars cast to int. Tim