From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.efficios.com (mail.efficios.com [167.114.26.124]) by sourceware.org (Postfix) with ESMTPS id B165538708CD for ; Tue, 19 May 2020 18:21:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B165538708CD Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 67FA02AAB3B; Tue, 19 May 2020 14:21:09 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id fBLJCeg8qSvf; Tue, 19 May 2020 14:21:09 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 32C212AAB3A; Tue, 19 May 2020 14:21:09 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 32C212AAB3A X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id MFhObsJHq78W; Tue, 19 May 2020 14:21:09 -0400 (EDT) Received: from [10.0.0.193] (unknown [192.222.164.54]) by mail.efficios.com (Postfix) with ESMTPSA id 185CE2AA8D6; Tue, 19 May 2020 14:21:09 -0400 (EDT) Subject: Re: [PATCH] gdb: fix off-by-one error in quirk_rust_enum To: Tom Tromey , Simon Marchi via Gdb-patches References: <20200519181557.1625215-1-simon.marchi@efficios.com> <87lfln7pqh.fsf@tromey.com> From: Simon Marchi Message-ID: <08c51bfe-fce7-75e9-53bd-86b8cc85117a@efficios.com> Date: Tue, 19 May 2020 14:21:08 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <87lfln7pqh.fsf@tromey.com> Content-Type: text/plain; charset=utf-8 Content-Language: tl Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 May 2020 18:21:10 -0000 On 2020-05-19 2:18 p.m., Tom Tromey wrote: >>>>>> "Simon" == Simon Marchi via Gdb-patches writes: > > Simon> Found by inspection, so I don't have a test for it (I don't think it > Simon> would be easy to have this bug cause a failure reliably). > > Simon> We allocate space for N fields into `new_fields`, then memcpy N fields > Simon> at `new_fields + 1`. This overflows the allocated buffer by one field. > > Simon> Fix it by allocating `N + 1` fields. > > Simon> gdb/ChangeLog: > > Simon> * dwarf2/read.c (quirk_rust_enum): Allocate enough fields. > > Looks good. Thank you. > > Tom > Thanks, pushed. Simon