public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/106778] New: libcpp/makeuname2c.cc:454: sanity check in wrong place ?
@ 2022-08-30 13:08 dcb314 at hotmail dot com
2022-08-30 13:10 ` [Bug c/106778] " dcb314 at hotmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: dcb314 at hotmail dot com @ 2022-08-30 13:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106778
Bug ID: 106778
Summary: libcpp/makeuname2c.cc:454: sanity check in wrong place
?
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
Static analyser cppcheck can be made to say:
libcpp/makeuname2c.cc:454:19: style: Array index 'off' is used before limits
check. [arrayIndexThenCheck]
Source code is
assert (tree[off] == 0 && off < tree_size);
Suggest sanity check array index before use, not after.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/106778] libcpp/makeuname2c.cc:454: sanity check in wrong place ?
2022-08-30 13:08 [Bug c/106778] New: libcpp/makeuname2c.cc:454: sanity check in wrong place ? dcb314 at hotmail dot com
@ 2022-08-30 13:10 ` dcb314 at hotmail dot com
2022-08-30 15:30 ` [Bug preprocessor/106778] " jakub at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: dcb314 at hotmail dot com @ 2022-08-30 13:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106778
David Binderman <dcb314 at hotmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
Adding author of code.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/106778] libcpp/makeuname2c.cc:454: sanity check in wrong place ?
2022-08-30 13:08 [Bug c/106778] New: libcpp/makeuname2c.cc:454: sanity check in wrong place ? dcb314 at hotmail dot com
2022-08-30 13:10 ` [Bug c/106778] " dcb314 at hotmail dot com
@ 2022-08-30 15:30 ` jakub at gcc dot gnu.org
2022-08-31 8:25 ` cvs-commit at gcc dot gnu.org
2022-08-31 9:51 ` jakub at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-08-30 15:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106778
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Last reconfirmed| |2022-08-30
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Nothing important, but will change after testing.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/106778] libcpp/makeuname2c.cc:454: sanity check in wrong place ?
2022-08-30 13:08 [Bug c/106778] New: libcpp/makeuname2c.cc:454: sanity check in wrong place ? dcb314 at hotmail dot com
2022-08-30 13:10 ` [Bug c/106778] " dcb314 at hotmail dot com
2022-08-30 15:30 ` [Bug preprocessor/106778] " jakub at gcc dot gnu.org
@ 2022-08-31 8:25 ` cvs-commit at gcc dot gnu.org
2022-08-31 9:51 ` jakub at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-31 8:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106778
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:b3048b6ffb126a4624f66bad713fe6d1dc6dc13d
commit r13-2301-gb3048b6ffb126a4624f66bad713fe6d1dc6dc13d
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Aug 31 10:22:36 2022 +0200
libcpp: Make static checkers happy about makeuname2c [PR106778]
The assertion ensures that we point within the image and at a byte
we haven't touched yet (or at least that it isn't the first byte
of an already stored tree), some static checker was unhappy about
first checking that it is zero and only afterwards checking that it
is within bounds.
2022-08-31 Jakub Jelinek <jakub@redhat.com>
PR preprocessor/106778
* makeuname2c.cc (write_nodes): Reverse order of && operands in
assert.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug preprocessor/106778] libcpp/makeuname2c.cc:454: sanity check in wrong place ?
2022-08-30 13:08 [Bug c/106778] New: libcpp/makeuname2c.cc:454: sanity check in wrong place ? dcb314 at hotmail dot com
` (2 preceding siblings ...)
2022-08-31 8:25 ` cvs-commit at gcc dot gnu.org
@ 2022-08-31 9:51 ` jakub at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-08-31 9:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106778
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Changed now.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-31 9:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-30 13:08 [Bug c/106778] New: libcpp/makeuname2c.cc:454: sanity check in wrong place ? dcb314 at hotmail dot com
2022-08-30 13:10 ` [Bug c/106778] " dcb314 at hotmail dot com
2022-08-30 15:30 ` [Bug preprocessor/106778] " jakub at gcc dot gnu.org
2022-08-31 8:25 ` cvs-commit at gcc dot gnu.org
2022-08-31 9:51 ` jakub 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).