public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "steve at sk2 dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/59974] New: ostream crashes on large numbers under Windows Date: Tue, 28 Jan 2014 23:28:00 -0000 [thread overview] Message-ID: <bug-59974-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59974 Bug ID: 59974 Summary: ostream crashes on large numbers under Windows Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: steve at sk2 dot org Created attachment 31972 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31972&action=edit Test case This is forwarded from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=736946 and courtesy of Jeff Epler. The attached program crashes when built with x86_64-w64-mingw32-g++ or i686-w64-mingw32-g++. The underlying cause is an assumption that snprintf never returns -1. In fact, on Windows, the platform snprintf returns -1 when the buffer is not big enough, which leads to (A) calling alloca(-1) and (B) calling std::widen with fin < st, either one of which is probably enough to lead to a crash. The patch shown below fixes several locations in libstdc++ where a negative return value from snprintf was not properly handled. The bug was filed against gcc 4.6.3 but it also applies to 4.8.2 and the current 4.9 snapshot in Debian (20140122). Note that the mingw-w64 can mask this bug by providing its own vsnprintf implementation when building libstdc++. Regards, Stephen
next reply other threads:[~2014-01-28 23:28 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-01-28 23:28 steve at sk2 dot org [this message] 2014-01-28 23:29 ` [Bug libstdc++/59974] " steve at sk2 dot org 2014-01-28 23:33 ` pinskia at gcc dot gnu.org 2014-01-28 23:36 ` steve at sk2 dot org 2023-06-09 1:52 ` 10walls at gmail dot com 2023-06-09 9:45 ` redi at gcc dot gnu.org 2023-06-09 11:18 ` steve at sk2 dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-59974-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).