#39687: wcsrtombs with NULL dest pointer doesn't ignore len parameter Open Date: 2019-10-19 17:38 Last Update: 2019-11-09 22:01 URL for this Ticket: https://osdn.net//projects/mingw/ticket/39687 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=39687 --------------------------------------------------------------------- Last Changes/Comment on this Ticket: 2019-11-09 22:01 Updated by: keith Comment: I've attached a tentative patch, which goes at least part of the way towards resolving this issue. When I run my previous test case under wine-4.18, on my Manjaro Linux box, I see: $ mingw32-g++ tc39687.cc $ LC_CTYPE="en_GB.65001" ./a.exe | cat Locale: English_United Kingdom.Multibyte string: A wstring-ß水𝄋 Length, including '\0': 20 which is consistent with the behaviour I observe from my original (native) GNU/ Linux test. (Note that I have to give the LC_CTYPE spec in a mixed Linux/Microsoft format, because wine's use of libfontconfig raises complaints about a Microsoft-style language_region part, but not the .codeset part, which I do, currently, need to give as a Microsoft codepage number; the output from wine is piped through cat because wine, itself, garbles the display of non-ASCII UTF-8 code points, when the output is direct to the UTF-8 encoded terminal, whereas cat reads the correctly formatted UTF-8 output stream, and subsequently displays it correctly). --------------------------------------------------------------------- Ticket Status: Reporter: gallickgunner Owner: keith Type: Issues Status: Open [Owner assigned] Priority: 5 - Medium MileStone: (None) Component: WSL Severity: 5 - Medium Resolution: None --------------------------------------------------------------------- Ticket details: I'm using MinGW-gcc-6.3.0. The wcsrtombs() function as mentioned in the docs on cppreference should return the number of bytes that would have been written to src. However it doesn't do so on my end. It seems the implementation doesn't ignore the length parameter when dest is passed as NULL? A similar issue was reported and presumably fixed for the Mingw-w64 on the sourceforge site Currently working around by passing INT_MAX as the length parameter, so it finishes within the limit and returns the size. I apologize in advance if this is just an issue from my end or if any other info is missing. First time submitting a ticket :) -- Ticket information of MinGW - Minimalist GNU for Windows project MinGW - Minimalist GNU for Windows Project is hosted on OSDN Project URL: https://osdn.net/projects/mingw/ OSDN: https://osdn.net URL for this Ticket: https://osdn.net/projects/mingw/ticket/39687 RSS feed for this Ticket: https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=39687