From patchwork Sat Apr 28 03:24:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Robertson X-Patchwork-Id: 27015 Received: (qmail 122459 invoked by alias); 28 Apr 2018 03:27:55 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 122406 invoked by uid 89); 28 Apr 2018 03:27:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=dan, Dan X-HELO: mail-yb0-f175.google.com Received: from mail-yb0-f175.google.com (HELO mail-yb0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 28 Apr 2018 03:27:53 +0000 Received: by mail-yb0-f175.google.com with SMTP id q74-v6so1352048ybg.6 for ; Fri, 27 Apr 2018 20:27:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=is5fiAm+D3pK76Ph73K0CDdKs0Chgcm77D+Xf3TIDPk=; b=PIw5/L7h+eL03JWy1vh9kdye0DKDZtikwBeR0Cc7t4EafyFtq2aInNozaRn4vFnrjZ /wmxPtFzEMdiPIiIkMA0JJyZWKhcp4E0qeH30bfZDaTA42PLW3ktBoedBoiup+gJ8G3E VZYjUZJfsgKlarz+WMJLR8Swd0acdcXzbGmTa/GIsFZKK5p9hGKdzWuPoOzDmA4CLrvA 5amn4jBv+LXjlWeW/R1eVlO9XRzrH9x6xm9Gh9NgHvc/9+4LXfUvWZYSNrYVcHnO1uKx anh67INmIJOP8jon5nB3i7QeeBJ8ErXwNAmeUVAKFT7F7U7ZI5jam3ISWIY6fP8lXdiT sodg== X-Gm-Message-State: ALQs6tD7XGIT2+7IS6h7xH7bQJPIQVmwxB3I8eqqD91VqLXxzwKtrCBK YvHx3hI6T23n+dw84wHwTNJ98g== X-Google-Smtp-Source: AB8JxZo3k/Z+wv43+EewXfO9bhnXZLbD1PtB7VNT6+mUz3hgyxFaHs7BUfJscaRZyPaLhNBnPQJABw== X-Received: by 2002:a25:7792:: with SMTP id s140-v6mr2555173ybc.330.1524886070976; Fri, 27 Apr 2018 20:27:50 -0700 (PDT) Received: from tomyris ([2601:c2:c100:d169:5ab2:4b40:897c:82a9]) by smtp.gmail.com with ESMTPSA id w200-v6sm1256004yww.61.2018.04.27.20.27.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Apr 2018 20:27:49 -0700 (PDT) Date: Sat, 28 Apr 2018 03:24:43 +0000 From: Dan Robertson To: gdb-patches@sourceware.org Subject: [PATCH] bug 23124: rust - Fix null deref when casting Message-ID: <20180428032443.GA1869@tomyris> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.5 (2018-04-13) Attached a patch that fixes bug 23124. Cheers, Dan From 7ebef0f7305cfe9bc56bf658dc889abf2da4ee02 Mon Sep 17 00:00:00 2001 From: Dan Robertson 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 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