Send MinGW-Notify mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.osdn.me/mailman/listinfo/mingw-notify
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of MinGW-Notify digest..."


Please do not reply to this notification; the sender address is unable to 
accept incoming e-mail.  If you wish to unsubscribe you can do so at 
https://lists.osdn.me/mailman/listinfo/mingw-notify.



Today's Topics:

   1. [mingw] #39687: wcsrtombs with NULL dest pointer doesn't
      ignore len parameter (MinGW Notification List)


----------------------------------------------------------------------

Message: 1
Date: Tue, 29 Oct 2019 20:23:50 +0000
From: MinGW Notification List <[email protected]>
To: OSDN Ticket System <[email protected]>
Subject: [MinGW-Notify] [mingw] #39687: wcsrtombs with NULL dest
        pointer doesn't ignore len parameter
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8

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



  Open Date: 2019-10-19 17:38
Last Update: 2019-10-29 20:23

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-29 20:23 Updated by: keith

Comment:

Reply To gallickgunner

    I think the site encppreference gives a perfect example....

Alas, as it now stands, (and as it was originally), it isn't particularly
useful. Its problems originate in this statement:

    std::setlocale(LC_ALL, "");

which, on MS-Windows, is somewhat dysfunctional; it does not respect LC_CLASS
environment variables, but rather just aligns the runtime locale with the
pre-configured console code page, (which, in my case, is English_United
Kingdom.1252). In the majority of usage cases, for western language locales,
that will represent a single byte character encoding, in which a significant
majority of Unicode code points cannot be represented, so the conversion fails
with errno = EILSEQ, when you give it any of the majority of wchar_t inputs in
which the high order byte is non-zero. This is exactly what happens, with your
original example, when run with code page 1252, (so the correctly displayed
byte count for Length would be zero — i.e. 1 + (size_t)(-1)).



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


------------------------------

Subject: Digest Footer

_______________________________________________
MinGW-Notify mailing list
[email protected]
https://lists.osdn.me/mailman/listinfo/mingw-notify


------------------------------

End of MinGW-Notify Digest, Vol 25, Issue 15
********************************************

Reply via email to