Date: Wed, 17 Nov 2004 00:36:28 +0100 (CET) From: Jean-Yves Lefort <jylefort@brutele.be> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/74020: regexec() hangs with UTF-8 locales Message-ID: <20041116233628.1524B22E18@jsite.lefort.net> Resent-Message-ID: <200411162340.iAGNeOm9084078@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 74020
>Category: bin
>Synopsis: regexec() hangs with UTF-8 locales
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Nov 16 23:40:23 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator: Jean-Yves Lefort
>Release: FreeBSD 5.3-RELEASE i386
>Organization:
>Environment:
System: FreeBSD jsite.lefort.net 5.3-RELEASE FreeBSD 5.3-RELEASE #0: Fri Nov 12 15:27:39 CET 2004 jylefort@jsite.lefort.net:/usr/obj/usr/src/sys/JSITE i386
>Description:
In some situations, regexec() hangs.
>How-To-Repeat:
Compile this:
--- cut ---
#include <locale.h>
#include <sys/types.h>
#include <regex.h>
#include <assert.h>
int
main (int argc, char **argv)
{
int status;
regex_t test_re;
regmatch_t pmatch[3];
setlocale(LC_ALL, "");
status = regcomp(&test_re, "foo=(.*) bar=(.*)", REG_EXTENDED);
assert(status == 0);
/* if the locale encoding is UTF-8, this call hangs */
regexec(&test_re, "foo=one bar=two\302\251", test_re.re_nsub + 1, pmatch, 0);
return 0;
}
--- cut ---
Works fine when executed with a non UTF-8 locale:
$ LANG=en_US.ISO8859-1 ./test
$
Hangs when executed with an UTF-8 locale:
$ LANG=en_US.UTF-8 ./test
<yawn>
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041116233628.1524B22E18>
