public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/66492] New: std::messages<wchar_t> unsafe and inefficient
@ 2015-06-10 16:04 msebor at gcc dot gnu.org
  2015-06-10 17:17 ` [Bug libstdc++/66492] " redi at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: msebor at gcc dot gnu.org @ 2015-06-10 16:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66492

            Bug ID: 66492
           Summary: std::messages<wchar_t> unsafe and inefficient
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

The following observations were made in a private conversation with
jwakely@redhat.com, after reading the libstdc++ implementation of the
messages<wchar_t> facet.  Jonathan asked me to open a bug for the record.  I
have no test case and not all the points may be accurate or even correct.

The messages<wchar_t> facet in libstdc++ looks like it could be improved. 
AFAICS, it does three codeset conversions:

1) one in libc (induced by bind_textdomain_codeset),
2) another in do_get to convert the default string to the external encoding
(this seems entirely unnecessary), and
3) finally one of the libc text to the internal encoding (this one is
unavoidable).

It's not clear to me that (1) will do the right thing when the locale argument
to messages<wchar_t>::open has a user-defined codecvt facet.

(3) doesn't seem to handle codeset conversion errors correctly (even though the
standard doesn't require it, it should probably return the default string
instead of an empty or truncated string). Using alloca for what's essentially
user-controlled strings also seems risky.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug libstdc++/66492] std::messages<wchar_t> unsafe and inefficient
  2015-06-10 16:04 [Bug libstdc++/66492] New: std::messages<wchar_t> unsafe and inefficient msebor at gcc dot gnu.org
@ 2015-06-10 17:17 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2015-06-10 17:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66492

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-06-10
     Ever confirmed|0                           |1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-10 17:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-10 16:04 [Bug libstdc++/66492] New: std::messages<wchar_t> unsafe and inefficient msebor at gcc dot gnu.org
2015-06-10 17:17 ` [Bug libstdc++/66492] " redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).