public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "alexhenrie24 at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/110426] New: Missing buffer overflow warning with function pointer that has the alloc_size attribute Date: Tue, 27 Jun 2023 04:18:48 +0000 [thread overview] Message-ID: <bug-110426-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110426 Bug ID: 110426 Summary: Missing buffer overflow warning with function pointer that has the alloc_size attribute Product: gcc Version: 13.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: alexhenrie24 at gmail dot com Target Milestone: --- I expected to get a warning when compiling this program with -fanalyzer: #include <stdlib.h> extern void* (*my_alloc)(size_t) __attribute__ ((alloc_size (1))); int main(void) { int *x = my_alloc(1); x[0] = 0; // buffer overflow! return 0; } There is a warning if I call malloc instead of my_alloc.
next reply other threads:[~2023-06-27 4:18 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-27 4:18 alexhenrie24 at gmail dot com [this message] 2023-06-28 15:54 ` [Bug analyzer/110426] " dmalcolm at gcc dot gnu.org 2023-08-04 20:20 ` cvs-commit at gcc dot gnu.org 2023-08-04 20:24 ` dmalcolm at gcc dot gnu.org 2023-08-16 19:25 ` alexhenrie24 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-110426-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).