Files
semi-libc/src/string
Gabriel RavierandRich Felker 07616721f1 fix return value of wcs{,n}cmp for extreme wchar_t values
As a result of using simple subtraction to implement the return values
for wcscmp and wcsncmp, integer overflow can occur (producing
undefined behavior, and in practice, a wrong comparison result). This
does not occur for meaningful character values (21-bit range) but the
functions are specified to work on arbitrary wchar_t arrays.

This patch replaces the subtraction with a little bit of code that
orders the characters correctly, returning -1 if the character from
the first string is smaller than the one from the second, 0 if they
are equal and 1 if the character from the first string is larger than
the one from the second.
2023-02-12 17:50:59 -05:00
..
2011-02-12 00:22:29 -05:00
2013-08-28 03:34:57 -04:00
2018-09-12 14:34:37 -04:00
2011-02-12 00:22:29 -05:00
2011-02-12 00:22:29 -05:00
2011-02-12 00:22:29 -05:00
2011-04-06 14:28:29 -04:00
2020-12-09 11:34:29 -05:00
2011-02-12 00:22:29 -05:00
2011-02-12 00:22:29 -05:00
2018-09-12 14:34:37 -04:00
2011-02-12 00:22:29 -05:00
2011-02-12 00:22:29 -05:00
2011-02-12 00:22:29 -05:00
2011-02-12 00:22:29 -05:00
2018-09-23 02:51:01 -04:00