From: Hui Zhu <teawater@gmail.com>
To: gdb-patches ml <gdb-patches@sourceware.org>
Subject: [RFA] tracepoint remote.c:remote_trace_set_readonly_regions give up some regions if it is number is too big
Date: Sun, 12 Jun 2011 14:02:00 -0000 [thread overview]
Message-ID: <BANLkTin2q0Aae9RPF7vamjzPZAT+=d7qvQ@mail.gmail.com> (raw)
Hi,
My GDB got crash with a ELF file when I use tracepoint with it. I
found that it have 12898 sections.
So in remote_trace_set_readonly_regions:
sprintf (target_buf + strlen (target_buf),
":%s,%s", tmp1, tmp2);
It will over write other val, it make GDB crash.
So I add a check before it to fix it:
if (strlen (target_buf) + strlen(tmp1) + strlen(tmp2) + 3 >
target_buf_size)
{
warning (_("Give up some read only regions."));
break;
}
Please help me review it.
And this issue affect 7.3 too. Does it can check in to 7.3?
Thanks,
Hui
2011-06-12 Hui Zhu <teawater@gmail.com>
* remote.c (remote_trace_set_readonly_regions): Add a check for
target_buf_size.
---
remote.c | 5 +++++
1 file changed, 5 insertions(+)
--- a/remote.c
+++ b/remote.c
@@ -9996,6 +9996,11 @@ remote_trace_set_readonly_regions (void)
size = bfd_get_section_size (s);
sprintf_vma (tmp1, vma);
sprintf_vma (tmp2, vma + size);
+ if (strlen (target_buf) + strlen(tmp1) + strlen(tmp2) + 3 >
target_buf_size)
+ {
+ warning (_("Give up some read only regions."));
+ break;
+ }
sprintf (target_buf + strlen (target_buf),
":%s,%s", tmp1, tmp2);
}
next reply other threads:[~2011-06-12 14:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-12 14:02 Hui Zhu [this message]
2011-06-13 12:21 ` Pedro Alves
2011-06-15 7:35 ` Hui Zhu
2011-06-15 10:27 ` Pedro Alves
2011-06-15 15:53 ` Hui Zhu
2011-06-15 16:27 ` Pedro Alves
2011-06-16 2:24 ` Hui Zhu
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='BANLkTin2q0Aae9RPF7vamjzPZAT+=d7qvQ@mail.gmail.com' \
--to=teawater@gmail.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