From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19457 invoked by alias); 29 Apr 2018 03:49:59 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 19439 invoked by uid 89); 29 Apr 2018 03:49:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1047, Hx-spam-relays-external:cmsmtp, H*RU:cmsmtp, deref X-HELO: gateway32.websitewelcome.com Received: from gateway32.websitewelcome.com (HELO gateway32.websitewelcome.com) (192.185.145.107) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 29 Apr 2018 03:49:56 +0000 Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway32.websitewelcome.com (Postfix) with ESMTP id 7145BD4806F for ; Sat, 28 Apr 2018 22:49:55 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id CdLXfCcw1y2aLCdLXfXoAJ; Sat, 28 Apr 2018 22:49:55 -0500 X-Authority-Reason: nr=8 Received: from 97-122-176-117.hlrn.qwest.net ([97.122.176.117]:36768 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1fCdLX-002Rkt-5P; Sat, 28 Apr 2018 22:49:55 -0500 From: Tom Tromey To: Dan Robertson Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] bug 23124: rust - Fix null deref when casting References: <20180428032443.GA1869@tomyris> Date: Sun, 29 Apr 2018 03:49:00 -0000 In-Reply-To: <20180428032443.GA1869@tomyris> (Dan Robertson's message of "Sat, 28 Apr 2018 03:24:43 +0000") Message-ID: <87fu3e7jtp.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Source-L: No X-Exim-ID: 1fCdLX-002Rkt-5P X-Source-Sender: 97-122-176-117.hlrn.qwest.net (bapiya) [97.122.176.117]:36768 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2018-04/txt/msg00599.txt.bz2 >>>>> "Dan" == Dan Robertson writes: Dan> Attached a patch that fixes bug 23124. Thanks for the patch. This is the right fix, but there are a few nits. If you want to address those, that would be nice. If you can't, I will do it on Monday. It is missing a ChangeLog entry. It's normal to mention the bug in the ChangeLog, see any of the ones mentioning "PR .../NNNN". It needs a test, feel free to just drop the simplest thing possible into gdb/testsuite/gdb.rust/expr.exp. The test suite, for some reason, has a ChangeLog of its own. Dan> - for (const rust_op *op : *params) Dan> - result.push_back (convert_ast_to_type (state, op)); Dan> + if (params) { Dan> + for (const rust_op *op : *params) { Dan> + result.push_back (convert_ast_to_type (state, op)); Dan> + } Dan> + } In the gdb flavor of GNU style, one would format this as: if (params != nullptr) { for (const rust_op *op : *params) result.push_back (convert_ast_to_type (state, op)); } Tom