From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 3A6683858D1E for ; Tue, 4 Oct 2022 09:25:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3A6683858D1E Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 690F9219D4; Tue, 4 Oct 2022 09:25:50 +0000 (UTC) Received: from hawking.suse.de (unknown [10.168.4.11]) by relay2.suse.de (Postfix) with ESMTP id 626BB2C146; Tue, 4 Oct 2022 09:25:50 +0000 (UTC) Received: by hawking.suse.de (Postfix, from userid 17005) id DA3904401E9; Tue, 4 Oct 2022 11:25:49 +0200 (CEST) From: Andreas Schwab To: Tsukasa OI Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 2/2] gdb/riscv: Fix buffer overflow on riscv_insn::fetch_instruction References: <89612fe01d902007bf84a7dfb0df5f85d5c166e4.1664873933.git.research_trasio@irq.a4lg.com> <29872020-9f00-b639-717e-a31a3e614210@irq.a4lg.com> X-Yow: I'm definitely not in Omaha! Date: Tue, 04 Oct 2022 11:25:49 +0200 In-Reply-To: <29872020-9f00-b639-717e-a31a3e614210@irq.a4lg.com> (Tsukasa OI's message of "Tue, 4 Oct 2022 18:14:55 +0900") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.1 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.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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, 04 Oct 2022 09:25:53 -0000 On Okt 04 2022, Tsukasa OI wrote: > That's technically possible but it will make something like... > 8 + 2 + 2 * ((1 << 3) - 1 - 1) That's still a magic number that doesn't adapt. > Defining RISCV_MAX_INSN_LEN might be a slightly better solution (still, > content of RISCV_MAX_INSN_LEN will be a magic number). If that number is then used as the base for the other dependencies, it's a win. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."