This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PUSHED PATCH] Add null pointer check in ctf_xfer_partial
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Sat, 19 Apr 2014 10:35:05 +0800
- Subject: [PUSHED PATCH] Add null pointer check in ctf_xfer_partial
- Authentication-results: sourceware.org; auth=none
I find a gdb crash when gdb reads ctf trace. The crash is caused by passing
NULL to strcmp. This patch is to add null pointer check, as what we did
somewhere else in ctf.c.
Patch is pushed in.
gdb:
2014-04-19 Yao Qi <yao@codesourcery.com>
* ctf.c (ctf_xfer_partial): Check 'name' is NULL before strcmp.
---
gdb/ChangeLog | 4 ++++
gdb/ctf.c | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 21907fa..2d2b839 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2014-04-19 Yao Qi <yao@codesourcery.com>
+
+ * ctf.c (ctf_xfer_partial): Check 'name' is NULL before strcmp.
+
2014-04-18 Siva Chandra Reddy <sivachandra@google.com>
* valops.c (oload_method_static): Remove unnecessary argument
diff --git a/gdb/ctf.c b/gdb/ctf.c
index df9ca52..f21dcdf 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1402,7 +1402,7 @@ ctf_xfer_partial (struct target_ops *ops, enum target_object object,
= bt_ctf_iter_read_event (ctf_iter);
const char *name = bt_ctf_event_name (event);
- if (strcmp (name, "frame") == 0)
+ if (name == NULL || strcmp (name, "frame") == 0)
break;
else if (strcmp (name, "memory") != 0)
{
--
1.9.0