public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/14975] New: Segfault on low-level write error during imbue
@ 2004-04-16 15:00 peturr02 at ru dot is
  2004-04-16 15:02 ` [Bug libstdc++/14975] " peturr02 at ru dot is
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: peturr02 at ru dot is @ 2004-04-16 15:00 UTC (permalink / raw)
  To: gcc-bugs

This bit from basic_filebuf::imbue in include/bits/fstream.tcc can't
possibly be correct:

              else if (_M_writing && (__testvalid = _M_terminate_output()))
                _M_set_buffer(-1);
            }
        }

      if (__testvalid)
        _M_codecvt = _M_codecvt_tmp;

If __testvalid is false for some reason (for example because
_M_terminate_output returned false because of a low-level write error),
then _M_codecvt will still point to the codecvt facet from the old locale.

Since no reference is kept to the old locale, the facet may be deleted at
any time, and so keeping a pointer to it is certainly wrong.

-- 
           Summary: Segfault on low-level write error during imbue
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: peturr02 at ru dot is
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14975


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

end of thread, other threads:[~2004-04-29 10:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-16 15:00 [Bug libstdc++/14975] New: Segfault on low-level write error during imbue peturr02 at ru dot is
2004-04-16 15:02 ` [Bug libstdc++/14975] " peturr02 at ru dot is
2004-04-16 15:19 ` pcarlini at suse dot de
2004-04-16 15:19 ` peturr02 at ru dot is
2004-04-16 15:50 ` pcarlini at suse dot de
2004-04-16 17:27 ` cvs-commit at gcc dot gnu dot org
2004-04-17 15:07 ` [Bug libstdc++/14975] [3.4 only] " peturr02 at ru dot is
2004-04-18  2:22 ` pcarlini at suse dot de
2004-04-29 10:42 ` cvs-commit at gcc dot gnu dot org
2004-04-29 11:37 ` pcarlini at suse dot de

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