public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "felix-gcc at fefe dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/19351] operator new[] can return heap blocks which are too small Date: Tue, 01 Apr 2008 21:25:00 -0000 [thread overview] Message-ID: <20080401212428.16101.qmail@sourceware.org> (raw) In-Reply-To: <bug-19351-192@http.gcc.gnu.org/bugzilla/> ------- Comment #15 from felix-gcc at fefe dot de 2008-04-01 21:24 ------- I think we can all agree it does not matter what we call this problem. Real world programs have security problems because of this. -fstack-protector carries a much larger run-time cost and gcc still offers it, and there is even less grounds to argue by any C or C++ standard that it's not the programmer's fault. gcc still offers it. As mentioned in the other bug, Microsoft Visual C++ already does this check. They do it like this. After the multiplication they check of the overflow flag is set, which on x86 indicates the result does not fit in the lower 32 bits. If so, instead of the truncated value it passes (size_t)-1 the operator new, which causes that operator new to fail (in the default case at least, a user may define its own operator new and that one might still return something). My favorite solution would be for the code to fail immediately. Throw an exception or return NULL, depending on which operator new the program called. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19351
next prev parent reply other threads:[~2008-04-01 21:25 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-19351-192@http.gcc.gnu.org/bugzilla/> 2006-09-27 23:51 ` geoffk at gcc dot gnu dot org 2006-09-27 23:56 ` Andrew Pinski 2006-09-27 23:56 ` pinskia at physics dot uc dot edu 2007-03-23 15:00 ` mmitchel at gcc dot gnu dot org 2007-03-23 15:09 ` schwab at suse dot de 2007-03-23 15:23 ` fw at deneb dot enyo dot de 2008-04-01 20:46 ` pinskia at gcc dot gnu dot org 2008-04-01 20:48 ` pinskia at gcc dot gnu dot org 2008-04-01 21:25 ` felix-gcc at fefe dot de [this message] 2008-04-01 21:52 ` rguenth at gcc dot gnu dot org 2008-12-09 23:25 ` mrs at apple dot com 2010-02-06 8:20 ` fw at gcc dot gnu dot org 2010-03-22 18:40 ` tglek at mozilla dot com 2010-03-25 16:45 ` fw at gcc dot gnu dot org 2010-03-25 16:58 ` manu at gcc dot gnu dot org 2010-03-25 17:14 ` fw at gcc dot gnu dot org 2010-05-23 11:04 ` fw at gcc dot gnu dot org [not found] <bug-19351-4@http.gcc.gnu.org/bugzilla/> 2011-01-22 21:27 ` fw at gcc dot gnu.org 2011-05-24 13:00 ` redi at gcc dot gnu.org 2011-05-24 20:12 ` fw at gcc dot gnu.org 2005-01-09 22:18 [Bug c++/19351] New: " fw at deneb dot enyo dot de 2005-01-09 22:25 ` [Bug c++/19351] " pinskia at gcc dot gnu dot org 2005-01-09 22:35 ` fw at deneb dot enyo dot de 2005-01-09 22:45 ` pinskia at gcc dot gnu dot org 2005-01-09 22:47 ` pinskia at gcc dot gnu dot org 2005-01-09 22:48 ` bangerth at dealii dot org 2005-01-09 23:07 ` fw at deneb dot enyo dot de 2005-01-09 23:12 ` pinskia at gcc dot gnu 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=20080401212428.16101.qmail@sourceware.org \ --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).