4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-16 19:40:07 +08:00
Corinna Vinschen c0d7d3e1a2 cygwin wcsxfrm: byte swap result ourselves
Workaround a bug (or undocumented behaviour) in LCMapStringW:

It's documented(*) that the cchDest parameter is a byte count with
LCMAP_SORTKEY, but a character count otherwise.  But the docs don't
state what happens if you combine LCMAP_SORTKEY with LCMAP_BYTEREV.

Tests indicate that LCMAP_SORTKEY treats cchDest as byte count, but
then LCMAP_BYTEREV treats it as char count in the same call.  So the
latter swaps twice as much bytes in the destination buffer than the
byte count it returns, which potentially results in writing past the
end of the given output buffer.

Solution: Don't specify LCMAP_BYTEREV in the LCMapStringW(LCMAP_SORTKEY)
call, rather byte swap afterwards.

(*) https://msdn.microsoft.com/en-us/library/windows/desktop/dd318702(v=vs.85).aspx

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-06-06 18:27:47 +02:00
..
2017-04-04 12:23:18 +02:00
2017-03-11 10:03:29 +01:00
2016-11-24 16:09:31 +01:00
2017-03-27 22:03:58 +01:00
2017-04-04 12:23:18 +02:00
2016-08-23 15:07:42 +01:00
2016-06-25 00:43:01 +02:00
2017-03-22 11:10:15 +01:00
2017-03-22 11:10:15 +01:00
2016-06-24 23:32:39 +02:00
2015-03-03 12:58:34 +00:00
2016-06-25 00:43:01 +02:00
2016-06-24 23:32:39 +02:00
2015-11-18 19:09:47 +01:00
2017-03-27 22:03:58 +01:00
2017-03-27 22:03:58 +01:00
2017-03-27 22:03:58 +01:00
2017-01-19 21:42:10 +01:00
2015-08-17 11:05:43 +02:00
2016-06-23 16:56:41 +02:00
2016-06-23 21:30:15 +02:00
2016-06-24 23:32:39 +02:00
2016-08-19 16:27:07 +02:00
2017-01-19 21:42:10 +01:00
2017-03-27 22:03:58 +01:00
2016-06-23 16:56:41 +02:00
2016-08-18 10:27:28 +02:00
2017-04-24 17:14:03 +02:00
2017-04-24 17:14:03 +02:00
2016-06-24 23:33:01 +02:00