From: Corinna Vinschen <vinschen@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] windows-nat.c: Fix type of local variable
Date: Tue, 19 Mar 2013 14:51:00 -0000 [thread overview]
Message-ID: <20130319144413.GR3003@calimero.vinschen.de> (raw)
Hi,
the below patch fixes a crash on x86_64 Cygwin.
The call to ReadProcessMemory takes a SIZE_T* as fifth parameter.
SIZE_T is 64 bit on x86_64. However, the local variable `n' is defined
as DWORD, which is only 32 bit. Therefore, when ReadProcessMemory
returns, 32 unrelated bits on the stack are overwritten. On x86_64
Cygwin that's the lower 32 bits of the local variable `'s'. The
following xfree(s) call then SEGVs. Other calls to ReadProcessMemory
in the same file already use a SIZE_T variable in that place.
Ok to apply?
Thanks,
Corinna
* windows-nat.c (handle_output_debug_string): Change type of n to
SIZE_T to avoid crash on 64 bit systems.
Index: windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/windows-nat.c,v
retrieving revision 1.241
diff -u -p -r1.241 windows-nat.c
--- windows-nat.c 27 Feb 2013 19:42:26 -0000 1.241
+++ windows-nat.c 19 Mar 2013 14:43:03 -0000
@@ -973,7 +973,7 @@ handle_output_debug_string (struct targe
if (gotasig)
{
LPCVOID x;
- DWORD n;
+ SIZE_T n;
ourstatus->kind = TARGET_WAITKIND_STOPPED;
retval = strtoul (p, &p, 0);
if (!retval)
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
next reply other threads:[~2013-03-19 14:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-19 14:51 Corinna Vinschen [this message]
2013-03-19 15:06 ` Joel Brobecker
2013-03-19 15:14 ` Corinna Vinschen
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=20130319144413.GR3003@calimero.vinschen.de \
--to=vinschen@redhat.com \
--cc=gdb-patches@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: 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