[MinGW-Notify] [mingw] #39687: wcsrtombs with NULL dest pointer doesn't ignore len parameter

Back to archive index
MinGW Notification List mingw****@lists*****
Wed Oct 23 02:27:03 JST 2019


#39687: wcsrtombs with NULL dest pointer doesn't ignore len parameter

  Open Date: 2019-10-19 18:38
Last Update: 2019-10-22 18:27

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-10-22 18:27 Updated by: keith
 * Owner Update from (None) to keith

 * Component Update from GCC to WSL

 * Details Updated

 * Summary Updated


Comment:

Thanks for bringing this to my attention.

Yes, there are issues with the MinGW implementations of wcsrtombs(), and the
related wcrtomb() functions. They go far beyond this mishandling of a NULL
pointer destination in wcsrtombs(); in particular, they fail to defer to the
Microsoft implementations, which were first introduced by MSVCR80.DLL, and
subsequently retrofitted to MSVCRT.DLL in Vista, in addition to both being
non-conforming (to ISO-C99), w.r.t. handling of a NULL destination pointer.

I'll look into providing conforming implementations, for mingwrt-5.3 — these
are runtime library issues, not issues with GCC itself. In the meantime, it
would be helpful if you can provide a SSCCE to both demonstrate the issue, and
test any potential solution.



---------------------------------------------------------------------
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



More information about the MinGW-Notify mailing list
Back to archive index