public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/98247] Analyzer fails to detect certain out-of-bounds uses of flexible array members Date: Fri, 09 Sep 2022 21:44:20 +0000 [thread overview] Message-ID: <bug-98247-4-flIttpLZYD@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-98247-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98247 David Malcolm <dmalcolm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Summary|RFE: detect Flexible Array |Analyzer fails to detect |Member misuse in analyzer |certain out-of-bounds uses | |of flexible array members Last reconfirmed| |2022-09-09 Status|UNCONFIRMED |NEW Version|11.0 |13.0 --- Comment #5 from David Malcolm <dmalcolm at gcc dot gnu.org> --- The above patch adds test coverage for various uses of the flexible array member idiom, inspired by your test case above (thanks!) It adds one xfail; in test_symbolic_size_oob, where there's a false negative, where it fails to complain about this code: struct str * test_symbolic_size_oob (size_t len) { /* Forgetting to add space for the trailing array. */ struct str *str = malloc(sizeof(str)); if (str) { str->len = len; memset(str->data, 'x', len); /* { dg-warning "heap-based buffer overflow" "PR analyzer/98247" { xfail *-*-* } } */ // TODO(xfail): we don't yet complain about this case, which occurs when len > 0 return str; } return NULL; } I'm going to repurpose this bug to track fixing that false negative; updating subject accordingly.
prev parent reply other threads:[~2022-09-09 21:44 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-11 16:32 [Bug c/98247] New: gcc analyzer does not detect Flexible Array Member misuse vince.a.bridgers at gmail dot com 2021-03-19 14:08 ` [Bug analyzer/98247] RFE: detect Flexible Array Member misuse in analyzer dmalcolm at gcc dot gnu.org 2022-08-26 18:00 ` dmalcolm at gcc dot gnu.org 2022-08-26 18:04 ` dmalcolm at gcc dot gnu.org 2022-09-09 21:11 ` cvs-commit at gcc dot gnu.org 2022-09-09 21:44 ` dmalcolm at gcc dot gnu.org [this message]
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-98247-4-flIttpLZYD@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).