public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "antonio.chirizzi at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/99044] New: use-after-free false positive Date: Tue, 09 Feb 2021 19:41:12 +0000 [thread overview] Message-ID: <bug-99044-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99044 Bug ID: 99044 Summary: use-after-free false positive Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: antonio.chirizzi at gmail dot com Target Milestone: --- Created attachment 50157 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50157&action=edit Reproducer for the bug Please find attached the reproducer for this use-after-free which looks a false positive. ls-tree-with-commit.c: In function ‘oid2strbuf_free’: ls-tree-with-commit.c:53:17: warning: use after ‘free’ of ‘e_strbuf’ [CWE-416] [-Wanalyzer-use-after-free] 53 | strbuf_release(e_strbuf->value); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ‘oid2strbuf_free’: events 1-6 | | 51 | while ((e = hashmap_iter_next(&iter))) { | | ^ | | | | | (1) following ‘true’ branch (when ‘e’ is non-NULL)... | | (4) following ‘true’ branch (when ‘e’ is non-NULL)... | 52 | struct oid2strbuf *e_strbuf = (struct oid2strbuf *)e; | | ~~~~~~~~ | | | | | (2) ...to here | | (5) ...to here | 53 | strbuf_release(e_strbuf->value); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (6) use after ‘free’ of ‘e_strbuf’; freed at (3) | 54 | free(e_strbuf->value); | 55 | free(e); | | ~~~~~~~ | | | | | (3) freed here use "gcc -fanalyzer -c ls-tree-with-commit.c"
next reply other threads:[~2021-02-09 19:41 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-09 19:41 antonio.chirizzi at gmail dot com [this message] 2021-02-09 22:15 ` [Bug analyzer/99044] use-after-free false positive in loop dmalcolm at gcc dot gnu.org 2021-03-25 0:48 ` cvs-commit at gcc dot gnu.org 2021-03-25 0:55 ` dmalcolm 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-99044-4@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).