From patchwork Mon Nov 13 21:57:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Wielaard X-Patchwork-Id: 79779 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F22D43AA9C2D for ; Mon, 13 Nov 2023 21:57:25 +0000 (GMT) X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 69067386483A for ; Mon, 13 Nov 2023 21:57:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 69067386483A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 69067386483A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=45.83.234.184 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699912640; cv=none; b=PSYswJP4zA6KYQr6wakqYSW2B0I1mheXzi+/1Ol+zmVqHm0MvCHlNQbssAkYAE1IOE4G6+sJJaymADa5YKnOarpmFqh+ZYtYHY3cS0YjT9juCXvWH6oeeJDenmC/EicxvKfIm+60wr1ZqRBGlBpB5g0u46pyFOhfNJjPPvgfgAc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1699912640; c=relaxed/simple; bh=ITVMMUj2dAF7pcb7Im1kioTbWjEz+k+xDH+hHXEFJEU=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=o4SHNPu/3HEyP0KYXfg06uBYKF1VuWM7VSqJXpDOj7VxzXtiuOtlAQHfReu+qJcmQcRiLUTQQyF5m41tnV2PYllA+FSOSf0UyC3y01CGpZ+FgpJJbpRF3No/4UpPTj/kIl2+97D8vjW9wDIW64gqa7VPv9Qr0kOaxVd1Q1PtluQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from csb.redhat.com (deer0x03.wildebeest.org [172.31.17.133]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 4F4FC302FDD8; Mon, 13 Nov 2023 22:57:16 +0100 (CET) Received: by csb.redhat.com (Postfix, from userid 10916) id 1D222CF38C; Mon, 13 Nov 2023 22:57:16 +0100 (CET) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [COMMITTED] backends: Fix arm_machine_flag_name version string. Date: Mon, 13 Nov 2023 22:57:07 +0100 Message-Id: <20231113215707.1680971-1-mark@klomp.org> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Spam-Status: No, score=-3034.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org arm_machine_flag_name checks the version byte and if not zero returns a version string. There are only 5 versions defined. So check the version byte is not larger. * backends/arm_machineflagname.c (arm_machine_flag_name): Check version <= 0, otherwise return NULL. https://sourceware.org/bugzilla/show_bug.cgi?id=31058 Signed-off-by: Mark Wielaard --- backends/arm_machineflagname.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backends/arm_machineflagname.c b/backends/arm_machineflagname.c index e93092ae..d700d5f4 100644 --- a/backends/arm_machineflagname.c +++ b/backends/arm_machineflagname.c @@ -48,7 +48,7 @@ arm_machine_flag_name (Elf64_Word orig, Elf64_Word *flagref) "Version5 EABI", }; *flagref &= ~((Elf64_Word) EF_ARM_EABIMASK); - return vername[version - 1]; + return version <= 5 ? vername[version - 1] : NULL; } switch (EF_ARM_EABI_VERSION (orig)) {