public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "bugdal at aerifal dot cx" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug libc/12547] realloc(p, 0) violates C99 Date: Fri, 27 Feb 2015 19:11:00 -0000 [thread overview] Message-ID: <bug-12547-131-xLjlATBaDv@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-12547-131@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=12547 --- Comment #14 from Rich Felker <bugdal at aerifal dot cx> --- Double-free is not easily detected except in the case where both frees take place in sequence with no intervening allocations. For example, in a case like this: void *p = malloc(n); realloc(p, 0); void *q = malloc(n); free(p); it's very likely that line 4 will end up freeing the allocation made in line 3. The resulting state is extremely dangerous and almost always leads to arbitrary code execution if enough effort is put into the analysis. Memory leaks, on the other hand, are at worst a DoS issue. Marking of a feature as "obsolescent" does not grant the implementation permission to do crazy things like printing messages. It's purely a warning to applications that the interface may be removed, or its behavior may become undefined, in future versions of the language standard. Code using it is still perfectly valid and conforming to the current language standard. -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2015-02-27 19:11 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-03-06 22:48 [Bug libc/12547] New: " msebor at gmail dot com 2011-03-11 1:11 ` [Bug libc/12547] " drepper.fsp at gmail dot com 2011-03-17 19:03 ` jsm28 at gcc dot gnu.org 2011-03-24 17:10 ` eblake at redhat dot com 2011-03-24 17:20 ` eblake at redhat dot com 2011-03-24 17:23 ` jakub at redhat dot com 2011-03-25 0:08 ` bruno at clisp dot org 2011-04-01 22:52 ` eblake at redhat dot com 2011-04-01 23:40 ` drepper.fsp at gmail dot com 2011-04-07 17:06 ` nick at usenix dot org 2014-02-16 17:51 ` jackie.rosen at hushmail dot com 2014-05-28 19:43 ` schwab at sourceware dot org 2014-06-27 13:47 ` fweimer at redhat dot com 2015-02-22 20:49 ` bugdal at aerifal dot cx 2015-02-23 12:19 ` joseph at codesourcery dot com 2015-02-23 18:09 ` bugdal at aerifal dot cx 2015-02-27 18:11 ` bruno at clisp dot org 2015-02-27 19:11 ` bugdal at aerifal dot cx [this message] 2015-08-22 20:32 ` [Bug malloc/12547] " jsm28 at gcc dot gnu.org 2019-10-03 11:58 ` bugdal at aerifal dot cx
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-12547-131-xLjlATBaDv@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.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).