From: David Daney <ddaney@caviumnetworks.com>
To: Andrew Haley <aph@redhat.com>
Cc: Martin Ettl <ettl.martin@gmx.de>, java@gcc.gnu.org
Subject: Re: found an overlapping data buffer in file natGCInfo.cc
Date: Mon, 27 Jul 2009 14:43:00 -0000 [thread overview]
Message-ID: <4A6DBCE9.4090807@caviumnetworks.com> (raw)
In-Reply-To: <4A6D7B5D.5090005@redhat.com>
Andrew Haley wrote:
> On 07/27/2009 10:29 AM, Martin Ettl wrote:
>> Hello,
>>
>> while checking the sources of gcc-4.4.1 with the static code analysis tool cppcheck i found an overlapping data buffer in file gcc-4.4.1/libjava/gnu/gcj/natGCInfo.cc at line 410.
>>
>> Take a look at the file:
>>
>> static void *
>> nomem_handler(size_t size)
>> {
>> if (oomDumpName)
>> {
>> char temp[strlen(oomDumpName) + 20];
>> 410 sprintf(temp, "%s%03d", temp, GC_dump_count++);
The second instance of temp should be oomDumpName.
>> printf("nomem_handler(%zd) called\n", size);
>> gc_ok--;
>> GC_enumerator x(temp);
>> x.enumerate();
>> gc_ok++;
>> }
>> return (void*)0;
>> }
>>
>> Indeed, the buffer overlapps. This can lead to segmentation faults!
>
> Thanks. How very weird; I wonder what that code was supposed to do.
>
Someone should fix it. If nobody does soon, I suppose I will as I added
it in the first place.
David Daney
next prev parent reply other threads:[~2009-07-27 14:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-27 8:29 Martin Ettl
2009-07-27 10:03 ` Andrew Haley
2009-07-27 14:43 ` David Daney [this message]
2009-07-27 17:01 ` Andrew Haley
2009-07-27 19:09 ` Martin Ettl
2009-07-28 8:08 ` Andrew Haley
2009-07-28 14:17 ` Martin Ettl
2009-07-29 7:11 ` Andrew Haley
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=4A6DBCE9.4090807@caviumnetworks.com \
--to=ddaney@caviumnetworks.com \
--cc=aph@redhat.com \
--cc=ettl.martin@gmx.de \
--cc=java@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: link
Be 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).