Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Dan Robertson <danlrobertson89@gmail.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] bug 23124: rust - Fix null deref when casting
Date: Sat, 28 Apr 2018 03:27:00 -0000	[thread overview]
Message-ID: <20180428032443.GA1869@tomyris> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 53 bytes --]

Attached a patch that fixes bug 23124.

Cheers,

Dan

[-- Attachment #1.2: 0001-bug-23124-rust-Fix-null-deref-when-casting.patch --]
[-- Type: text/x-diff, Size: 918 bytes --]

From 7ebef0f7305cfe9bc56bf658dc889abf2da4ee02 Mon Sep 17 00:00:00 2001
From: Dan Robertson <danlrobertson89@gmail.com>
Date: Sat, 28 Apr 2018 03:18:00 +0000
Subject: [PATCH] bug 23124: rust - Fix null deref when casting

Fix a null dereference when casting a value to a unit type.
---
 gdb/rust-exp.y | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gdb/rust-exp.y b/gdb/rust-exp.y
index b661a803e3..4be01b0719 100644
--- a/gdb/rust-exp.y
+++ b/gdb/rust-exp.y
@@ -2007,8 +2007,11 @@ convert_params_to_types (struct parser_state *state, rust_op_vector *params)
 {
   std::vector<struct type *> result;
 
-  for (const rust_op *op : *params)
-    result.push_back (convert_ast_to_type (state, op));
+  if (params) {
+    for (const rust_op *op : *params) {
+      result.push_back (convert_ast_to_type (state, op));
+    }
+  }
 
   return result;
 }
-- 
2.17.0


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2018-04-28  3:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-28  3:27 Dan Robertson [this message]
2018-04-29  3:49 ` Tom Tromey
2018-04-29 16:18   ` Dan Robertson
2018-05-01  5:09     ` Tom Tromey

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=20180428032443.GA1869@tomyris \
    --to=danlrobertson89@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