From: mec.gnu@mindspring.com (Michael Elizabeth Chastain)
To: gdb-patches@sources.redhat.com, randolph@tausq.org
Subject: [patch/hpux] hpread.c: init alloca'd memory, pr gdb/1661
Date: Mon, 31 May 2004 20:12:00 -0000 [thread overview]
Message-ID: <20040531201202.327C84B104@berman.michael-chastain.com> (raw)
This patch fixes some uninitialized memory in the HP symbol
table reader. See PR symtab/1661.
I tested this on native hppa2.0w-hp-hpux11.11 with hpcc
B.11.11.28706.GP and hpacc A.03.45.
MAINTAINERS says that "Any [past] maintainer" can modify the hp/ux
symtab reader, so I'm going to commit this in 24 hours if nobody
objects. After that, I am also going to test it on gdb_6_1-branch
and commit it to gdb_6_1-branch.
Michael C
2004-05-31 Michael Chastain <mec.gnu@mindspring.com>
Fix PR symtab/1661.
* hpread.c (hpread_pxdb_needed): Call memset after alloca.
(hpread_read_struct_type): Likewise.
Index: hpread.c
===================================================================
RCS file: /cvs/src/src/gdb/hpread.c,v
retrieving revision 1.48
diff -c -3 -p -r1.48 hpread.c
*** hpread.c 7 May 2004 05:48:49 -0000 1.48
--- hpread.c 31 May 2004 02:04:14 -0000
*************** hpread_pxdb_needed (bfd *sym_bfd)
*** 383,388 ****
--- 383,389 ----
if (header_section_size == (bfd_size_type) sizeof (DOC_info_PXDB_header))
{
buf = alloca (sizeof (DOC_info_PXDB_header));
+ memset (buf, 0, sizeof (DOC_info_PXDB_header));
if (!bfd_get_section_contents (sym_bfd,
header_section,
*************** hpread_pxdb_needed (bfd *sym_bfd)
*** 450,455 ****
--- 451,457 ----
{
buf = alloca (sizeof (PXDB_header));
+ memset (buf, 0, sizeof (PXDB_header));
if (!bfd_get_section_contents (sym_bfd,
header_section,
buf, 0,
*************** hpread_read_struct_type (dnttpointer hp_
*** 3686,3691 ****
--- 3688,3694 ----
/* Get space to record the next field/data-member. */
new = (struct nextfield *) alloca (sizeof (struct nextfield));
+ memset (new, 0, sizeof (struct nextfield));
new->next = list;
list = new;
*************** hpread_read_struct_type (dnttpointer hp_
*** 3764,3769 ****
--- 3767,3773 ----
n_templ_args++;
/* Allocate and fill in a struct next_template */
t_new = (struct next_template *) alloca (sizeof (struct next_template));
+ memset (t_new, 0, sizeof (struct next_template));
t_new->next = t_list;
t_list = t_new;
t_list->arg.name = VT (objfile) + fieldp->dtempl_arg.name;
*************** hpread_read_struct_type (dnttpointer hp_
*** 3904,3909 ****
--- 3908,3914 ----
/* Get space to record this member function */
/* Note: alloca used; this will disappear on routine exit */
fn_new = (struct next_fn_field *) alloca (sizeof (struct next_fn_field));
+ memset (fn_new, 0, sizeof (struct next_fn_field));
fn_new->next = fn_list;
fn_list = fn_new;
*************** hpread_read_struct_type (dnttpointer hp_
*** 4021,4026 ****
--- 4026,4032 ----
/* Get space to record this static member */
new = (struct nextfield *) alloca (sizeof (struct nextfield));
+ memset (new, 0, sizeof (struct nextfield));
new->next = list;
list = new;
*************** hpread_read_struct_type (dnttpointer hp_
*** 4051,4056 ****
--- 4057,4063 ----
warning ("Debug info inconsistent: FIELD of anonymous union doesn't have a_union bit set");
/* Get space to record the next field/data-member. */
new = (struct nextfield *) alloca (sizeof (struct nextfield));
+ memset (new, 0, sizeof (struct nextfield));
new->next = list;
list = new;
*************** hpread_read_struct_type (dnttpointer hp_
*** 4082,4087 ****
--- 4089,4095 ----
warning ("Debug info inconsistent: SVAR field in anonymous union doesn't have a_union bit set");
/* Get space to record the next field/data-member. */
new = (struct nextfield *) alloca (sizeof (struct nextfield));
+ memset (new, 0, sizeof (struct nextfield));
new->next = list;
list = new;
*************** hpread_read_struct_type (dnttpointer hp_
*** 4102,4107 ****
--- 4110,4116 ----
warning ("Debug info inconsistent: DVAR field in anonymous union doesn't have a_union bit set");
/* Get space to record the next field/data-member. */
new = (struct nextfield *) alloca (sizeof (struct nextfield));
+ memset (new, 0, sizeof (struct nextfield));
new->next = list;
list = new;
*************** hpread_read_struct_type (dnttpointer hp_
*** 4150,4155 ****
--- 4159,4165 ----
/* Get space to record the next field/data-member. */
new = (struct nextfield *) alloca (sizeof (struct nextfield));
+ memset (new, 0, sizeof (struct nextfield));
new->next = list;
list = new;
*************** hpread_read_struct_type (dnttpointer hp_
*** 4233,4238 ****
--- 4243,4249 ----
break;
i_new = (struct next_instantiation *) alloca (sizeof (struct next_instantiation));
+ memset (i_new, 0, sizeof (struct next_instantiation));
i_new->next = i_list;
i_list = i_new;
i_list->t = hpread_type_lookup (field, objfile);
next reply other threads:[~2004-05-31 20:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-31 20:12 Michael Elizabeth Chastain [this message]
2004-06-01 1:45 ` Andrew Cagney
2004-06-01 2:39 Michael Elizabeth Chastain
2004-06-01 3:09 ` Randolph Chung
2004-06-01 3:15 Michael Elizabeth Chastain
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=20040531201202.327C84B104@berman.michael-chastain.com \
--to=mec.gnu@mindspring.com \
--cc=gdb-patches@sources.redhat.com \
--cc=randolph@tausq.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