From: Randolph Chung <randolph@tausq.org>
To: Michael Elizabeth Chastain <mec.gnu@mindspring.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [commited] small changes to fix hpux-cc compile
Date: Sun, 16 May 2004 17:21:00 -0000 [thread overview]
Message-ID: <20040516172101.GN566@tausq.org> (raw)
In-Reply-To: <20040516155532.8F75E4B104@berman.michael-chastain.com>
> So what happens if your hardcoded auto array of size 4 ever overflows?
> We get a nasty bit of stack corruption. I hate seeing code like this
> creep into gdb. It works until something else changes and then it
> quietly crashes or prints random bad results.
ok, how about like this then? this is consistent with how __dld_flags
isused in other parts of somsolib.c
2004-05-16 Randolph Chung <tausq@debian.org>
* somsolib.c (som_solib_remove_inferior_hook): Make all the size
references to dld_flags_buffer consistent.
Index: somsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/somsolib.c,v
retrieving revision 1.33
diff -u -p -r1.33 somsolib.c
--- somsolib.c 16 May 2004 04:33:41 -0000 1.33
+++ somsolib.c 16 May 2004 17:19:04 -0000
@@ -1081,16 +1081,13 @@ som_solib_remove_inferior_hook (int pid)
msymbol = lookup_minimal_symbol ("__dld_flags", NULL, NULL);
addr = SYMBOL_VALUE_ADDRESS (msymbol);
- status = target_read_memory (addr, dld_flags_buffer, TARGET_INT_BIT / TARGET_CHAR_BIT);
+ status = target_read_memory (addr, dld_flags_buffer, 4);
- dld_flags_value = extract_unsigned_integer (dld_flags_buffer,
- sizeof (dld_flags_value));
+ dld_flags_value = extract_unsigned_integer (dld_flags_buffer, 4);
dld_flags_value &= ~DLD_FLAGS_HOOKVALID;
- store_unsigned_integer (dld_flags_buffer,
- sizeof (dld_flags_value),
- dld_flags_value);
- status = target_write_memory (addr, dld_flags_buffer, TARGET_INT_BIT / TARGET_CHAR_BIT);
+ store_unsigned_integer (dld_flags_buffer, 4, dld_flags_value);
+ status = target_write_memory (addr, dld_flags_buffer, 4);
do_cleanups (old_cleanups);
}
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
next prev parent reply other threads:[~2004-05-16 17:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-16 15:55 Michael Elizabeth Chastain
2004-05-16 17:21 ` Randolph Chung [this message]
-- strict thread matches above, loose matches on Subject: below --
2004-05-16 18:46 Michael Elizabeth Chastain
2004-05-16 10:12 Michael Elizabeth Chastain
2004-05-16 10:33 ` Mark Kettenis
2004-05-16 15:32 ` Randolph Chung
2004-05-16 4:35 Randolph Chung
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=20040516172101.GN566@tausq.org \
--to=randolph@tausq.org \
--cc=gdb-patches@sources.redhat.com \
--cc=mec.gnu@mindspring.com \
/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