From patchwork Thu Oct 27 15:33:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 59543 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 EB9E53886C41 for ; Thu, 27 Oct 2022 15:37:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EB9E53886C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666885022; bh=22pzgH2oXRJsp2RZesmRPBk3LUbhQHKSC1E164wvnZc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=G82XaUgyiJm+Im+ox238qV2OGVjqTFLiCB63hIi+z3ncrYSN2qpSGlTNDIJSJkJBz OGVbYbrOvtVc09uofW/2kpu35+i+vZgfCMYFO74tB2ZjcU9cBsLdhPpPUhf0jlR+Rf 5OOnxNcRoFU1hwelqKK71V5O+drnnhVOFGu0EzdA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70040.outbound.protection.outlook.com [40.107.7.40]) by sourceware.org (Postfix) with ESMTPS id D75C73829BDF for ; Thu, 27 Oct 2022 15:33:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D75C73829BDF ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=EFHEVoIUx+CXRXZg2/cEhAIv97EHlE4Ttn/vJskojOBNhkOvZEsa6s22ZaFL5WHukdpFTZY9NHetZEg4SJwwcwlN/2LfIxt1ptL2M1sukLZmst2Gw/bPi0nJfpVONKy7rsTdVz5dx4t2L+AM/4yDY53mc+FgbyyxtutgmII8RrSdnD4R3gAOLCQk+aNnWpKKaKI61h+Z6bIGkWfliYeUovfMoa/63Hf4DvhmNrYQ3sazSpkWPgo5U1Tl26gkRbpMJlYGgw8lX8q4Hzwf2wy0rfZilnulpNvFgUOhYa6qqOB8LFmkt6ktf3ReZvGaove66CSIVdlke0BlgVrY+f3sgA== ARC-Message-Signature: i=2; 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=22pzgH2oXRJsp2RZesmRPBk3LUbhQHKSC1E164wvnZc=; b=F0WcXqyvGsTg9w39t/LCFZMOGWVTPr5uI3Gq0QBHQiBex7pBfVUhhWfNhDcNV3RuDurwgBRvAmLrv5DhaM78GDJYONxumfFitoWzc9O8DLZNviH0bxl/KG0MqsXcyq2hk6IGZrAeY87MnJl/YS2hi6Z1JVSDowtYgxCDzSMEIQQZgHvAP59NwanoZmbrJyO9K1cLsd4f0Zyi8pFU8WSabwtof99Jiljb7IPjjJOS2R6mLe6K2adcqYgc/vpMJqxSfvSlQdFX1Wcu208EUMDI4rr7on9CYcFxG5a5W4wlMDRWHuNm146U52FxbTSpH93OiJ4BMi7gkRMofc3bnkqSHg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1, 1, smtp.mailfrom=arm.com] dmarc=[1, 1, header.from=arm.com]) Received: from AS8P251CA0003.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:2f2::23) by AM9PR08MB5873.eurprd08.prod.outlook.com (2603:10a6:20b:2dd::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14; Thu, 27 Oct 2022 15:33:35 +0000 Received: from AM7EUR03FT036.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:2f2:cafe::65) by AS8P251CA0003.outlook.office365.com (2603:10a6:20b:2f2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14 via Frontend Transport; Thu, 27 Oct 2022 15:33:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT036.mail.protection.outlook.com (100.127.140.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14 via Frontend Transport; Thu, 27 Oct 2022 15:33:35 +0000 Received: ("Tessian outbound 2ff13c8f2c05:v130"); Thu, 27 Oct 2022 15:33:35 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 022eaf5ce0d785cb X-CR-MTA-TID: 64aa7808 Received: from c54af3a1ab7a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F935813E-0250-4637-8350-77343A7A4C74.1; Thu, 27 Oct 2022 15:33:29 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c54af3a1ab7a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 27 Oct 2022 15:33:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HKTc4Jil0MqQjoDu48OhHmq4+Egdmo7nGY7ZDQk6ci9dZ6/LdPaxpLPRJRt8dlFcrvt82lnXV5sVY/K8wqdYegx8lnBG/Pg2sx8EbwMqKOj9ggeKy3rQadJHNtycnRRC/4t+yKrG+/X6ZwaMr/uhtafqKB8RmfcS+e8M1ofPIf/uWVXUq3Y/1a426eadZxj+60VxF1e9gkYAX+l8AaQS2DVufIWX7+rTOitm4/kGbsjt6/px1+HN0UHz3WLPjM6D8CX5wwklP9bbTjYyDRCX4C+ihUXf2iyitj3v1DgM6QiB0kuG8BBVO0qhVU4jnfsFzVMl4vhg/vNmO+ZVj8eN2Q== 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=22pzgH2oXRJsp2RZesmRPBk3LUbhQHKSC1E164wvnZc=; b=ggaflp6yXR+0RfU8EoP4+Bl27y5e1V6VaPavdjpz5OgH3+5MHDcFfxM8VNPiQp8LQ0YtC6A6ADwwrUG/uJe+QjEQHAHTLXlxKULGBTjZ+vUhGe7ajRGnvlKYRNn5x+hZC4Nxcx+MTGy/nWdLpfqdydD+3EZ00gd7BBxbYPIJDaMZIhUb0xHyBjOBhhvRCP4gPzc2KSiuLHpIZb9eKglJmhnwhvtVZf97oo8QAVFBkCU6OPJ4r7D1EjZY+Kgk4GhSoE2Z1jecXcDlX5SDvc/vQSX0Afk1eoCr10xjJ4apkMta+UsN6vNGt94zMp3I7B0pvxXXdYkOV0+by1QINkmazw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from DU2PR04CA0304.eurprd04.prod.outlook.com (2603:10a6:10:2b5::9) by DB9PR08MB8227.eurprd08.prod.outlook.com (2603:10a6:10:39f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.28; Thu, 27 Oct 2022 15:33:26 +0000 Received: from DBAEUR03FT038.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b5:cafe::2d) by DU2PR04CA0304.outlook.office365.com (2603:10a6:10:2b5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5769.14 via Frontend Transport; Thu, 27 Oct 2022 15:33:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DBAEUR03FT038.mail.protection.outlook.com (100.127.143.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5769.14 via Frontend Transport; Thu, 27 Oct 2022 15:33:25 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Thu, 27 Oct 2022 15:33:25 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Thu, 27 Oct 2022 15:33:24 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Thu, 27 Oct 2022 15:33:24 +0000 To: Subject: [PATCH 14/20] Fix off-by-one OOB write in iconv/tst-iconv-mt Date: Thu, 27 Oct 2022 16:33:24 +0100 Message-ID: <4b41e5f384f0416235a83e563823f18595484914.1666877952.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DBAEUR03FT038:EE_|DB9PR08MB8227:EE_|AM7EUR03FT036:EE_|AM9PR08MB5873:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e9f2c6d-abe0-4be8-3204-08dab8309cf3 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: wT1JN+SZtM0E4XPIACchesG+C+a3fAgUQ28b8BybgyRa1bOcsSWWRNUzEtQqJXqCF/fgvkj6raEVc7q2BYkpXo2qPuLJK93ReMaSMYhnoMmZVeC7UsdYAYjLJB+01GAxsL65B6uSqt8wbzwrV01OfQbma+i8YZpmqI+XfOsbS9IUUfPkdXUkFmc0d5V3tmD0LEEyJ16qqfolp6xJpXV9Mi2tq9kNfWxk5sOWRweG5nBmiuvu2gv6TgDWFc+K10NHXOUR16bKn3hK4175fxzJo+gdpl/WexXVNKL72dTygJG+bWig0Q09cqKamEryokz2av/z/NAzDe2wH1EIg7zX6UPILFXmIjpbCx877Yl8ALGGj9sgfIJu2ZhrOf6gllcN9shFrvSXQU7QkgzilidNZe2CbRixxQbKeCifwUYDmVO6jEBzY7HreH23ZBtlcxDxjFP6xOLSQ1vcJV33LEqLYb03reAduhsAZ44/e6JH8mp2IS1rsgDjzL/EtBbBgwIJYEg4PZOKmWmEfftuEEJJ6GypbIn4W1gkFsyRFKyng9Q8ols+6kwU+jMCldhA4ROZfaoCf6LFBTTR7W7x7XqTV/+4Q7/Im76IpD4wkhi6+N+8bNaBoYQhK5lNnxrKod/rSeXfc8Z50map9zrreNKVk+Rhp0a3DVb256+IUb5+hGqntE/nXpFInAeRJSBDzzIz91Mr0NSMU6oLInwL7sW0c5h1YkoSh2YBKoGCLIwpXqxn9QrBNchEcYJsCD6N2YWmodBZW7D7ARwA3sYgJIW+wC6ri7H48p6/DkJ+AzSxi4FVBf8nZSAZOeVH7fgzrJdn X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230022)(4636009)(376002)(346002)(396003)(39860400002)(136003)(451199015)(36840700001)(40470700004)(46966006)(26005)(2616005)(83380400001)(426003)(478600001)(36860700001)(7696005)(47076005)(186003)(336012)(2906002)(40460700003)(40480700001)(44832011)(4744005)(8676002)(70586007)(316002)(82310400005)(5660300002)(8936002)(70206006)(41300700001)(6916009)(86362001)(36756003)(356005)(81166007)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB8227 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 3021c03b-c6db-4325-3487-08dab83096d0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CrUitqwiwRcgutfxhWopr6AOKzPKC/cmYVog4fNmnvEd9IyuSBg3k/UHy9TvVFG4xuOzHnnsi5G09PJuWA6evXe95oLI3XEiXMqiW1TS92dOwxLndU7VfZHh7WE2xVM9SZ3LM68meAQfReVlHewhfTY9nTdbtmXJdqPN0/xyo5g+JDv9mGez/WfHlZ7v5vow2WX0EuYB2s9fUY20+jQdvzVNm0Zsv6mfMqirw+Iu8lxv78pkQ13Q9VtELVZ1SKA8cD/HhamveCayKiKS5IpcaAn3GFQDhIZqGaJDB84Q7Pm7EJLJqO9Ywv0TSezYbm5jXkUHP+6X3Re5ilnywxZIo/nXJvTi2q/LAW9robXNpS7EOsnstgZDQG2d0U+hVNy3q1x0FUUy2AmShTpcFJUpsSseWoPxPNNGwG9hPJMaZuQ3xD70UHOVX0WMri1aGHr48nlqRkSAJwHK77Zrkp5j7lULtRWND+ECrsNn0nCbVwoyRbQD0+Bb/kSBMVHk/pIYFQOWtfL1z/XRrc9mN7vVTUXiCAx2yPew6OKldplHrQwNx23HgwrJC+aYzWoxuRMBimIZ+aedmK59/PwAVGqkgKlI5h+axNM3eocXC0xL2pDHTc9JDBSALCMUJMcdfuYC8F5Il7JDPEe+kyyblW0XJSukzgMDAYKzxCLg19XaYvVb+o7e+UOUsnDFWg9v+sD66+HhZMNUkuFLpCupYQiRMuVKrJhcZaZX5yFDlD/K5zYQWLwvbgqKzShm1V2b8YIuBUYFyC875b0oNkxi+7P0hA== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230022)(4636009)(376002)(346002)(39860400002)(396003)(136003)(451199015)(46966006)(40470700004)(36840700001)(2906002)(186003)(47076005)(426003)(82310400005)(336012)(2616005)(26005)(83380400001)(7696005)(36860700001)(44832011)(40460700003)(70586007)(41300700001)(70206006)(478600001)(5660300002)(4744005)(6916009)(40480700001)(316002)(36756003)(81166007)(86362001)(8676002)(82740400003)(8936002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2022 15:33:35.6846 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e9f2c6d-abe0-4be8-3204-08dab8309cf3 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB5873 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The iconv buffer sizes must not include the \0 string terminator. When \0 cannot be part of a valid character encoding glibc iconv would copy it to the output as expected, but then later the explicit output termination with *outbufpos = '\0' is out of bounds. --- iconv/tst-iconv-mt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/iconv/tst-iconv-mt.c b/iconv/tst-iconv-mt.c index daaebd273b..0320885c06 100644 --- a/iconv/tst-iconv-mt.c +++ b/iconv/tst-iconv-mt.c @@ -58,11 +58,11 @@ worker (void * arg) char ascii[] = CONV_INPUT; char *inbufpos = ascii; - size_t inbytesleft = sizeof (CONV_INPUT); + size_t inbytesleft = sizeof (CONV_INPUT) - 1; char *utf8 = xcalloc (sizeof (CONV_INPUT), 1); char *outbufpos = utf8; - size_t outbytesleft = sizeof (CONV_INPUT); + size_t outbytesleft = sizeof (CONV_INPUT) - 1; if (tidx < TCOUNT/2) /* The first half of the worker thread pool synchronize together here,