Gabriel Ravier and Rich 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
..
2020-06-26 17:49:51 -04:00
2020-06-25 19:11:13 -04:00
2015-04-18 20:45:39 -04:00
2015-04-18 21:18:23 -04:00
2013-12-12 05:09:18 +00:00
2013-12-12 05:09:18 +00:00
2013-12-12 05:09:18 +00:00
2018-07-02 17:14:54 -04:00
2013-12-12 05:09:18 +00:00
2020-03-20 15:45:08 -04:00
2018-09-26 14:39:10 -04:00
2011-02-12 00:22:29 -05:00
2013-08-28 03:34:57 -04:00
2020-04-30 21:52:28 -04:00
2018-09-26 14:39:10 -04:00
2013-12-12 05:09:18 +00:00
2018-09-12 14:34:37 -04:00
2017-08-29 19:53:50 -04:00
2013-12-12 05:09:18 +00:00
2018-09-26 14:39:10 -04:00
2018-09-26 14:39:10 -04:00
2018-09-12 14:34:37 -04:00
2013-02-21 23:54:25 -05:00
2012-09-06 22:44:55 -04:00
2018-09-12 14:34:33 -04:00
2018-09-26 14:39:10 -04:00
2013-11-23 16:17:38 -05:00
2018-09-12 14:34:33 -04:00
2018-09-12 14:34:33 -04:00
2018-09-12 14:34:35 -04:00
2018-09-12 14:34:37 -04:00
2011-02-14 20:53:15 -05:00
2018-09-26 14:39:10 -04:00
2018-09-26 14:39:10 -04:00
2018-09-12 14:34:37 -04:00
2012-09-06 22:44:55 -04:00
2011-03-25 16:34:03 -04:00
2018-09-12 14:34:33 -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
2018-09-12 14:34:33 -04:00
2011-04-06 14:28:29 -04:00
2020-05-21 16:25:12 -04:00
2011-03-25 16:34:03 -04:00
2020-12-09 11:34:29 -05:00
2012-09-06 22:44:55 -04:00
2012-09-06 22:44:55 -04:00
2022-11-07 22:33:24 -05:00
2014-10-04 11:14:01 -04:00
2012-09-06 22:44:55 -04:00
2012-09-06 22:44:55 -04:00
2012-03-01 23:24:45 -05:00
2012-03-01 23:24:45 -05:00
2012-09-06 22:44:55 -04:00
2011-02-12 00:22:29 -05:00
2023-02-12 17:50:59 -05:00
2012-09-06 22:44:55 -04: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
2012-03-01 23:24:45 -05:00
2012-03-01 23:24:45 -05:00
2012-09-06 22:44:55 -04:00
2023-02-12 17:50:59 -05:00
2012-09-06 22:44:55 -04:00
2012-03-01 23:24:45 -05:00
2011-02-12 00:22:29 -05:00
2011-06-13 14:06:04 -04:00
2011-02-12 00:22:29 -05:00
2014-04-18 17:38:35 -04:00
2012-09-06 22:44:55 -04:00
2011-02-12 00:22:29 -05:00
2013-12-12 05:09:18 +00:00
2013-12-12 05:09:18 +00:00
2013-12-12 05:09:18 +00:00
2018-09-23 02:51:01 -04:00
2013-12-12 05:09:18 +00:00