freebsd_amp_hwpstate/lib/libc/regex
Bill Sommerfeld 8f7ed58a15 regex: mixed sets are misidentified as singletons
Fix "singleton" function used by regcomp() to turn character set matches
into exact character matches if a character set has exactly one
element.

The underlying cset representation is complex; most critically it
records"small" characters (codepoint less than either 128
or 256 depending on locale) in a bit vector, and "wide" characters in
a secondary array.

Unfortunately the "singleton" function uses to identify singleton sets
treated a cset as a singleton if either the "small" or the "wide" sets
had exactly one element (it would then ignore the other set).

The easiest way to demonstrate this bug:

	$ export LANG=C.UTF-8
	$ echo 'a' | grep '[abà]'

It should match (and print "a") but instead it doesn't match because the
single accented character in the set is misinterpreted as a singleton.

Reviewed by:	kevans, yuripv
Obtained from:	illumos
Differential Revision:	https://reviews.freebsd.org/D43149
2023-12-22 12:19:59 +07:00
..
grot libc: Purge unneeded cdefs.h 2023-11-01 16:44:30 -06:00
COPYRIGHT lib: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
Makefile.inc lib: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
Symbol.map libc: Remove empty comments in Symbol.map 2023-11-15 17:51:03 +00:00
WHATSNEW lib: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
cname.h lib: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
engine.c lib: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
re_format.7 lib: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
regcomp.c regex: mixed sets are misidentified as singletons 2023-12-22 12:19:59 +07:00
regerror.c lib: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
regex.3 lib: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
regex2.h lib: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
regexec.c lib: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
regfree.c lib: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00
utils.h lib: Remove ancient SCCS tags. 2023-11-26 22:23:28 -07:00