public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/59258] usan: ICE(segfault): stack-buffer-overflow with -fsanitize=undefined
Date: Sat, 23 Nov 2013 21:46:00 -0000 [thread overview]
Message-ID: <bug-59258-4-xDNWAw7i5w@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-59258-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59258
--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #3)
> Why? We are already checking that nelts is < 3. See the
> gcc_checking_assert above.
Well, at least to me it is not obvious whether it can get larger.
size_t i = 0;
if (loc != UNKNOWN_LOCATION)
i++
for (t = va_arg (args, tree); t != NULL_TREE;
i++, t = va_arg (args, tree))
gcc_checking_assert (i < 3);
vec_safe_push (saved_args, t);
Thus, saved_args probably has 0, 1 or 2 entries but with loc ==
UNKNOWN_LOCATION it could have 3.
if (mismatch != NULL)
i++;
for (i = 0; i < nelts; i++)
t = (*saved_args)[i];
If mismatch != NULL, (number of saved_args) == 2 and loc != UNKNOWN_LOCATION,
one has: 1+1+2*2 = 6 array elements, but only space for 5; with loc ==
UNKNOWN_LOCATION one could even have 0+1+2*(3) = 7.
I don't find it obvious that 5 is sufficient, even if closer inspection will
shows that this is always the case.
next prev parent reply other threads:[~2013-11-23 21:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-23 0:44 [Bug sanitizer/59258] New: " burnus at gcc dot gnu.org
2013-11-23 20:38 ` [Bug sanitizer/59258] " burnus at gcc dot gnu.org
2013-11-23 21:03 ` mpolacek at gcc dot gnu.org
2013-11-23 21:34 ` burnus at gcc dot gnu.org
2013-11-23 21:46 ` burnus at gcc dot gnu.org [this message]
2013-11-23 23:00 ` mpolacek at gcc dot gnu.org
2013-11-25 11:15 ` mpolacek at gcc dot gnu.org
2013-11-25 16:09 ` [Bug sanitizer/59258] ubsan: " mpolacek at gcc dot gnu.org
2013-11-25 18:51 ` jakub at gcc dot gnu.org
2013-11-26 21:27 ` jakub at gcc dot gnu.org
2013-11-26 21:30 ` jakub at gcc dot gnu.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-59258-4-xDNWAw7i5w@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: link
Be 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).