Summary: | A locale with zero collation rules cause fnmatch, regexec, and regcomp failures. | ||
---|---|---|---|
Product: | glibc | Reporter: | Carlos O'Donell <carlos> |
Component: | locale | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | REOPENED --- | ||
Severity: | normal | CC: | fweimer |
Priority: | P2 | Flags: | fweimer:
security-
|
Version: | 2.35 | ||
Target Milestone: | 2.35 | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Carlos O'Donell
2021-08-20 22:05:15 UTC
Fixed for glibc 2.35 via: commit f5117c6504888fab5423282a4607c552b90fd3f9 Author: Carlos O'Donell <carlos@redhat.com> Date: Thu Jul 29 22:45:39 2021 -0400 Add 'codepoint_collation' support for LC_COLLATE. Support a new directive 'codepoint_collation' in the LC_COLLATE section of a locale source file. This new directive causes all collation rules to be dropped and instead STRCMP (strcmp or wcscmp) is used for collation of the input character set. This is required to allow for a C.UTF-8 that contains zero collation rules (minimal size) and sorts using code point sorting. To date the only implementation of a locale with zero collation rules is the C/POSIX locale. The C/POSIX locale provides identity tables for _NL_COLLATE_COLLSEQMB and _NL_COLLATE_COLLSEQWC that map to ASCII even though it has zero rules. This has lead to existing fnmatch, regexec, and regcomp implementations that require these tables. It is not correct to use these tables when nrules == 0, but the conservative fix is to provide these tables when nrules == 0. This assures that existing static applications using a new C.UTF-8 locale with 'codepoint_collation' at least have functional range expressions with ASCII e.g. [0-9] or [a-z]. Such static applications would not have the fixes to fnmatch, regexec and regcomp that avoid the use of the tables when nrules == 0. Future fixes to fnmatch, regexec, and regcomp would allow range expressions to use the full set of code points for such ranges. Tested on x86_64 and i686 without regression. Reviewed-by: Florian Weimer <fweimer@redhat.com> The commit f5117c6504888fab5423282a4607c552b90fd3f9 does not solve this issue. The fix for this issue is to cleanup the regular expression range code: https://sourceware.org/pipermail/libc-alpha/2021-July/129588.html We dropped these fixes in the final C.UTF-8 implementation because it was possible to implement C.UTF-8 without fixing regexec et. al. If we fix the regular expression range handling code it will then work for all code point ranges correctly e.g. use the wide character values as range end points. As of today C.UTF-8 is limited to ASCII ranges because of this fix it missing. And all static applications until recompiled will be limited to ASCII ranges. |