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/115436] False positive with -Wanalyzer-malloc-leak Date: Tue, 11 Jun 2024 22:14:45 +0000 [thread overview] Message-ID: <bug-115436-4-8xPACQ3zqn@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-115436-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115436 David Malcolm <dmalcolm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2024-06-11 Ever confirmed|0 |1 --- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Thanks for filing this bug. I think there *might* be a true positive here for the case where s->cap == 0x80000000, so that s->cap * 2 becomes 0 due to overflow; should my_str_realloc be checking for s->str being null for the "needs malloc" case? Otherwise, confirmed with trunk using Compiler Explorer: https://godbolt.org/z/c3vEYf6do Looks like (a) it's not "realizing" that s->cap must be non-zero after the first alloc (with the caveat about overflow noted above) (b) there's a definite bug in binding_map, where __analyzer_dump () shows an overlapping concrete binding: clusters within root region cluster for: (*INIT_VAL(s_2(D))) ESCAPED key: {bytes 0-7} value: 'char *' {UNKNOWN(char *)} key: {bytes 0-23} value: 'struct my_str' {UNKNOWN(struct my_str)} key: {bytes 16-23} value: 'unsigned int' {UNKNOWN(unsigned int)} where the binding for bytes 0-23 overlaps that for bytes 0-7.
next prev parent reply other threads:[~2024-06-11 22:14 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-06-11 15:10 [Bug analyzer/115436] New: " rickobranimir at gmail dot com 2024-06-11 22:14 ` dmalcolm at gcc dot gnu.org [this message] 2024-06-12 7:14 ` [Bug analyzer/115436] " rickobranimir at gmail dot com
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-115436-4-8xPACQ3zqn@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).