From patchwork Fri Mar 31 10:07:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 77710 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp448668vqo; Fri, 31 Mar 2023 03:07:20 -0700 (PDT) X-Google-Smtp-Source: AKy350aswEdfBmBQzu3SpHSd+VldUeMWBlrPQPbhYHAKEAeJ58GomjTZka34C9EkOpdUQT/T1uPK X-Received: by 2002:aa7:cad7:0:b0:502:2a76:5781 with SMTP id l23-20020aa7cad7000000b005022a765781mr19581619edt.5.1680257240311; Fri, 31 Mar 2023 03:07:20 -0700 (PDT) Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id y15-20020aa7c24f000000b004fb6e2b5aacsi1676175edo.582.2023.03.31.03.07.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 03:07:20 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=feMAQcrp; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3B7FC38582BD for ; Fri, 31 Mar 2023 10:07:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B7FC38582BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1680257239; bh=cDJsrtkqPaGtPkDCzoXtQd0YbTs3jwB6n5FrfYaKGRk=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=feMAQcrpzxq73C+r4PdWjswkcHBNxOee6mta+APx+R8CbbsDi26+IOu/lfnFe+9hp 1GY9AubyqjqotA3LW22ngNu4pAs29muOvXS0Vz6ZZF/j72feYlLKhs3fXaYekjnJAQ GmyOpAYkS/dLwb4y/2Nl52fAZGfYhRO2MAdg3LPI= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2052.outbound.protection.outlook.com [40.107.14.52]) by sourceware.org (Postfix) with ESMTPS id 60FF63858D33 for ; Fri, 31 Mar 2023 10:07:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 60FF63858D33 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hwfPMXqoiRky82SnTkL8RmgoDwxsf82ZSp9iXIvj2WRnuhUV8sEXig7YeDCeuU0RpyDYyVrUAA/xya/8RbAfoMrDHVFzOcdzHaDmDvLJhKXaZwmLz+oNS1uosvejg1Vm3OvrBXSRnsgGYSMhJ2ypF+JmwowkNwE1FTCVNiVTSl9R2W3uD06cMWErzH1pXNx0iQEd3EI+dxvoI4ayKYUXFXOSRbz5aI+u5x460jdZc/m53E0Rf/2x2GOtLo5SSxBCWDpjnFqkMVKfgcW5A2WdGAWGRTo6IpZCahSAis5xeI2Tj/3a37ESx29wM65YLzcVPT+jZgqtgZx0OJ3n1mdvNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cDJsrtkqPaGtPkDCzoXtQd0YbTs3jwB6n5FrfYaKGRk=; b=RY3UuJN7dZzuyvtskumDDDJuW0RK24/3M03iRmBUB2jSjv5BnBegb9eCoZ477eWGzVIYFPLgkQkwOOS1POeJOWw66GAXjpQscw0eflXfV7rkhr5pH0ZGZFPY8gOWdP6A9t6xaOyxSeJs6X+ARoEi6JACfo+y4kRltEKj57u4YB+fOeJaHU8vzNK/NPGXvZFvovm+Z2Sj+FjV02JVFc6m21smO5sd6LUJZ8KgkIZXBaJmkTf0u+ZQpciDHhjWZwdHfAkkl11oFNGP/yChMfQ0nVJLyzl0HzQ5xhMREIi2AGbJz6ZIoYKN+IvjSFN/3giowyl83Dmed1dg06J0l0E88Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by PAXPR04MB9106.eurprd04.prod.outlook.com (2603:10a6:102:227::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.35; Fri, 31 Mar 2023 10:07:06 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::154e:166d:ec25:531b]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::154e:166d:ec25:531b%6]) with mapi id 15.20.6222.033; Fri, 31 Mar 2023 10:07:06 +0000 Message-ID: Date: Fri, 31 Mar 2023 12:07:04 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: [PATCH 3/3] gas: document that get_symbol_name() can clobber the input buffer Content-Language: en-US To: Binutils Cc: Nick Clifton , Alan Modra References: In-Reply-To: X-ClientProxiedBy: FR0P281CA0056.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:49::6) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|PAXPR04MB9106:EE_ X-MS-Office365-Filtering-Correlation-Id: ed74f95e-0ee4-449a-149f-08db31cfaeb2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S+1pjJeA5xe1f09MC5tqxsj2YfGzRJSHbze+Ci2H7X6XuFERlFFpVEdlnmKXr8iZdAynHFtY0b4b5BdePZ2WjUB3ESe5Vo6ve8X26jWnJnon2vaGstwnDeXNYTFAnuS32ljwMpqZZIxCjBdlnVQZPZR7zFtvIlsmK5yJVXVIdarch4zqEdLFie0QZUYt5Hwmvq+64HdVvrmf+SZogB7+ECo6MjFpBtvIu3l3COl9rqDVK8RfM39TQSqrq3ef/9f6RGeSFb/wA5T+Em8EYiOOvcNcj1tveSpCvbPp6F8NOZd5bFGsAbE16uLJrF8zl6sDBISO6GcmQM2gachzXNdX2kTWH+/LB0n6o1eCJdjM6FhRtFjLBzEROcDFmOFiOJHYP8bbnMCmWiWMmm7nYIT3hVsSwDpHm9tYBgFxuZ9ILXP8btDaPNZBScaF8usqPwGjoIS1tpc/wUnEU6oEXg8GPeg5/MdD/4kAqi40sPR+gKhJYa+JSX9MJzMpdZfNrg8DMcgHQP/48TXkbFdXKDoQq2+zjBr8E6erF/JxygljuC8LG4mURp+N0U6P+TabQaGqC6xmWWpXWyzTzUq9uRQTW0V+RlyfiQWS1xda8ScMutV4NBnwF6wgskJKFFmIxgpTilI9NQtghPdn7clmwd+q1g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6560.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(136003)(376002)(366004)(396003)(346002)(451199021)(31686004)(66556008)(83380400001)(26005)(6916009)(478600001)(316002)(31696002)(6506007)(36756003)(66946007)(41300700001)(8676002)(4326008)(86362001)(54906003)(66476007)(6512007)(2616005)(5660300002)(38100700002)(6486002)(2906002)(8936002)(186003)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?sLz9E3aM2SmZVRq1rBciM43nEQub?= =?utf-8?q?0RKWzzK0oh85wKqIDidNSJgeurvplRnyK8BSSh8+6wjXoLSRB6LhYWUEjZrgmE5n+?= =?utf-8?q?I1eC61n6Pzn1w2naBy8M+HkERCZD8qVJ8zEPK9beKA/2bzu29yJ+P92pUeW3j2pBX?= =?utf-8?q?GF+Zz+JL0BKRX+qihQFtzGu0O/5X15Qz/TtlKj/2tIue5fvGicxOd7S6CquHRSelK?= =?utf-8?q?52npeKwieC5iU/qV48TzulvdJULoiBVmMQqK80kGOAxOMDAeT+ptxoCwnnxuMgH4i?= =?utf-8?q?2rgdjP0LqThNFjNEloM5A7K6D9L5lsMauML8+EDwmCQOk3qJvKrABEFW9UGOBixdI?= =?utf-8?q?yTX3uCeHpVKB/Ng6bZMOzsy3oxFZqBA2gpDnkI0TRISgdqibmYTJHp5+soohgUbBq?= =?utf-8?q?1AzQHEygow2PlNLc+xDn/fcV6mSNAeDSEEcPCK/e67Z+lDEkTDKvTaAP7NFOjziQs?= =?utf-8?q?V+N2cgF7ZKBLQOCf7bWyXsdkKpKurSyu3nbZKmEWe7s8inrLys96LVse//sP3VTNA?= =?utf-8?q?hw/G5vQkT6uQIyDqcpf5cWCEJ/cMgxQGVG99Sbxw3XMjr4pm/zVjl6NCtkV59lKEO?= =?utf-8?q?7Yp4tZEVcRiWXaMbUt2Enc7E40V1qtMDG4tKVHlv3KsKLGXv8Juhc2j642AQbPP84?= =?utf-8?q?2SEE9SSJdmcMdJOV5fybGfVNfVhwExvU1CKm2IAkawIlmg4I4vwwsKN5g23NG09Id?= =?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ed74f95e-0ee4-449a-149f-08db31cfaeb2 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2023 10:07:06.3377 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: x1Ui6PsJ8Lh3nWp/nxv7j6ToxbqpdTZSDyEIzg2KPbHEnU4N07Z90Kb5vpvl1H5/QXoHH/ZF7MctTpZrNK++pg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9106 X-Spam-Status: No, score=-3028.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jan Beulich via Binutils From: Jan Beulich Reply-To: Jan Beulich Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761877416028003349?= X-GMAIL-MSGID: =?utf-8?q?1761877416028003349?= Callers which want to make further parsing attempts at the buffer passed to the function need to be aware that due to the potential of string concatenation the input buffer may be altered in ways beyond what can be undone by putting back at *input_line_pointer the character that the function returns. --- a/gas/expr.c +++ b/gas/expr.c @@ -2388,12 +2388,17 @@ resolve_expression (expressionS *express here lessens the crowd at read.c. Assume input_line_pointer is at start of symbol name, or the - start of a double quote enclosed symbol name. - Advance input_line_pointer past symbol name. - Turn that character into a '\0', returning its former value, - which may be the closing double quote. + start of a double quote enclosed symbol name. Advance + input_line_pointer past symbol name. Turn that character into a '\0', + returning its former value, which may be the closing double quote. + This allows a string compare (RMS wants symbol names to be strings) - of the symbol name. + of the symbol name. + + NOTE: The input buffer is further altered when adjacent strings are + concatenated by the function. Callers caring about the original buffer + contents will need to make a copy before calling here. + There will always be a char following symbol name, because all good lines end in end-of-line. */