opnsense-src/lib/libc/tests
Bill Sommerfeld 4f4860c9b0 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.

PR:		281710
Reviewed by:	kevans, yuripv
Obtained from:	illumos

(cherry picked from commit 8f7ed58a15556bf567ff876e1999e4fe4d684e1d)
2024-09-25 15:42:25 -05:00
..
c063 Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
db Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
gen libc: Purge unneeded cdefs.h 2023-11-26 21:20:09 -07:00
hash Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
iconv libc: Purge unneeded cdefs.h 2023-11-26 21:20:09 -07:00
inet Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
locale libc: Purge unneeded cdefs.h 2023-11-26 21:20:09 -07:00
net Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
nss libc: Purge unneeded cdefs.h 2023-11-26 21:20:09 -07:00
regex regex: mixed sets are misidentified as singletons 2024-09-25 15:42:25 -05:00
resolv Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
rpc Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
setjmp Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
ssp libc/tests: Further refine the condition for installing h_raw 2024-07-14 12:16:32 -04:00
stdio libc: Purge unneeded cdefs.h 2023-11-26 21:20:09 -07:00
stdlib pkgbase: install all libc test files into the tests package 2024-03-27 09:37:10 +01:00
string lib/libc/tests/string: add memrchr unit tests 2024-01-24 20:39:30 +01:00
sys libc/sys: add errno test 2024-03-02 07:05:05 +02:00
termios Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
time Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
tls pkgbase: install all libc test files into the tests package 2024-03-27 09:37:10 +01:00
tls_dso pkgbase: install all libc test files into the tests package 2024-03-27 09:37:10 +01:00
ttyio Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.netbsd-tests Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00