From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60060.outbound.protection.outlook.com [40.107.6.60]) by sourceware.org (Postfix) with ESMTPS id B0CE13857803 for ; Mon, 10 Jan 2022 13:09:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B0CE13857803 Received: from DB6PR0402CA0021.eurprd04.prod.outlook.com (2603:10a6:4:91::31) by DB9PR08MB7195.eurprd08.prod.outlook.com (2603:10a6:10:2ce::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Mon, 10 Jan 2022 13:09:38 +0000 Received: from DB5EUR03FT046.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:91:cafe::2d) by DB6PR0402CA0021.outlook.office365.com (2603:10a6:4:91::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.7 via Frontend Transport; Mon, 10 Jan 2022 13:09:38 +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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT046.mail.protection.outlook.com (10.152.21.230) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9 via Frontend Transport; Mon, 10 Jan 2022 13:09:38 +0000 Received: ("Tessian outbound dbb52aec1fa6:v110"); Mon, 10 Jan 2022 13:09:38 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 240e70a05c945ecf X-CR-MTA-TID: 64aa7808 Received: from 9b2af20a68d3.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id CDCFAEA9-6FB4-4AF0-88C2-99F2B00D150E.1; Mon, 10 Jan 2022 13:09:30 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9b2af20a68d3.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 10 Jan 2022 13:09:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M4vt/GYlD0mRs6Ik/kgVQhKnU3IU1+BAddbauDSVjSuq1OeDwVm7X5uuka/iW1ovrBtrthLnYmHySNXTP7ndeMQ6ctEgvfxhnuDcQiSTSHpwzoZO14BrFYNGiNYHTZnjeun57bL+toqNUlojb32Okb2XgmsoFRyz6sc13NerwRDzbL4ByJ1usu5xDSCFYnX7Cu9Fs3qdIqW39IqlqccQbPY9fDmaHWs0VDaHyzoRvlpypjHrEk5CuXzz3OnzxCfTnQ+bpsPUYVujbzz5Qa74VODVMq4saWYm8BR9Cf/ZwzP0BkjgSGS6OdTHwmMaQRsn0z3uATlGesnhcSL5NfrGLQ== 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=nVmfEmWnyS5sXALkYa3kj12XWMwzzCjCpRVibIeritI=; b=h9DHIF/lsIh3ZqcAf/ykFhd+d864g/zYyqDlawzrc13z87ERoNv91JfWv9A4rE/Dr5pzdh5uiWW37e1OuhgW8BWWUgFY6Pnwm9HOguykwkARIWJ8KqIGhihTLHdVOJ70M4X+zZIK5roOwoC8/B4rozQuxm2sX7dLHy7RB34fGctmGqdt4O3JNOFybKqOPnR1BC6BVAD/dmK8lBl78F3iG+PGodvRggVn5MfTBloSLqbAesS/usnWMyFPSBOindxmdICMofY+gxKZW1+2/rsmxS2GeNJmEYbdXuTg7I4mVRGZDJT2WaexCGwB/G2Nr02keAxJNYnDwEchp6YapCH/4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Received: from AS8PR08MB6534.eurprd08.prod.outlook.com (2603:10a6:20b:31c::10) by AM5PR0801MB1841.eurprd08.prod.outlook.com (2603:10a6:203:2e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.7; Mon, 10 Jan 2022 13:09:22 +0000 Received: from AS8PR08MB6534.eurprd08.prod.outlook.com ([fe80::4ef:cb7c:9e4c:fa1b]) by AS8PR08MB6534.eurprd08.prod.outlook.com ([fe80::4ef:cb7c:9e4c:fa1b%7]) with mapi id 15.20.4867.011; Mon, 10 Jan 2022 13:09:22 +0000 From: Wilco Dijkstra To: Florian Weimer , Wilco Dijkstra via Libc-alpha Subject: Re: [PATCH v2 3/7] string/test-str*cmp: remove stupid_[strcmp, strncmp, wcscmp, wcsncmp]. Thread-Topic: [PATCH v2 3/7] string/test-str*cmp: remove stupid_[strcmp, strncmp, wcscmp, wcsncmp]. Thread-Index: AQHYBhUSiP4i1OHuqEKL17pDxSPul6xcMvwKgAADAA0= Date: Mon, 10 Jan 2022 13:09:21 +0000 Message-ID: References: <87zgo3yd6w.fsf@oldenburg.str.redhat.com> In-Reply-To: <87zgo3yd6w.fsf@oldenburg.str.redhat.com> Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: suggested_attachment_session_id: 22451efb-fa64-d243-70f6-5188168b6f32 Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-MS-Office365-Filtering-Correlation-Id: 4af5f7a0-f175-4795-08b7-08d9d43a74f0 x-ms-traffictypediagnostic: AM5PR0801MB1841:EE_|DB5EUR03FT046:EE_|DB9PR08MB7195:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: lFMBf3ILtBHSsj0Afc9xXfIhTTo1p0LEsZ+N7W/L4AYbzm9H9paCUe40XouStufRUOVbJ6q7T/41hZvA9H8+csUWWPTTb/HVu22az2uSMO4LHSxhNrkEpuyzsLeeYjn70Jx870sOqxINAMT56ctH6kOBXRmFgwyqZOgn0pOIei6lWOIWBSDfWTpei/96LiwEH5n500uTjTyHGcSdQUqt3nonrV1sqiSBcajws4O26JYFHD9rRgiY9wjHJhlk+1cfyS9XMfdctVzOnYfTpgI5WLh3edKSL5E5Iuckaajv/xyFwdmXH4ZN+U7MleVUkuhVhrqzg64sZO/OyRDr0etHuEnwHzkyiJctVUPW7xFdIdT73R6QIqeRERtVqV9tJtiadFxhHbVZIGbOPbfhpTs9F+SEUJ2KMsnTPUGNwiNs9D8ar0ysdePt6S1M2RIaUvRe5/JmTPk2GL3hgF3c3mdP1jjy1W9Msn++SNICXzv8kM7Sf5i7Atfx2IL9JHwf8667vj6UrDVGeFmFpbaGP4bzhK13R4cykPaU9AC+hH+AeSqR4E8Pu8hp/+aJnMQNXDddZZRib2jNs8iPz38gNB72QAXIYsZvckz9uBRiEKFpISd0zq+ITrsCsJy+jRUFs3+is3OFuWwc3Fs6uzgmpC+SCxm09OFRoHzRJOOfzWNDV+9BVCLFV9xtk8weI0iZmwiyU92wO1vWyXsh6xr/ga4DJbrRCdgZOevfr0Nplho1Xa3MLs+3oHMKPUe5PPjLLU+Udut9bYPR4b2VQxlFaKdHy868yl84TVeh7PYvUw34/dpTa7hKE5UPWxJ70bIYWYpS X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR08MB6534.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(38100700002)(122000001)(9686003)(2906002)(508600001)(966005)(26005)(66946007)(7696005)(186003)(6506007)(55016003)(86362001)(76116006)(91956017)(110136005)(316002)(71200400001)(4326008)(38070700005)(83380400001)(8936002)(8676002)(66556008)(66446008)(66476007)(64756008)(52536014)(5660300002)(33656002)(133343001); DIR:OUT; SFP:1101; Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1841 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT046.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: d0fe6dfb-583b-4af2-8f68-08d9d43a6b27 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3dJ0dvQSSyjU+d/TgCTOoTSVHWtGfnYcNwmH0XTxv6sTGDpKMJy0a8Ktv0FMZiIF2hcuNLpA1m8rH9IA8JNqBxZDXs701O92tgGuUp13yGq3AqBvHHqtsdAPTevMFwfAAEmXsZO1J+qg7r5oKmD0xIOrVp3Rquk1DCt/QLK0OcRvPPcyU2aQZ+hDbFcI43Hfn6C5vnoR+id+mOvMchgibVVX/Qd+n3UlsXW6Iqzvjby0h0b8iF4eVrXtWo9luZ/xOaZS1RGxqL/NVmWDkJX3/E8WfssYGSVnoWGl8aj130oQkIlG/ZKl4W82XVCDQCQ10/IwgQVXbUK68lW0CpOHP1uO4hyJ92IqPc7Bid6IcJmUSEZayt5UP0PWllrORy6tZ93/2+whSH0mm7UEJzPKfI/Kpc0jUV1kGfRbtSY4td90Q8ZezD6sfVgMVjMpZ2CV1FX8jf1/MG9oGwyOQxr756Oez9YPLLAbuUEgl5IMaoMI0cMP4casokLj6fJaYFkh/mLqzIOOS5eRloibYIZvDaJcyts/hcjYotgh1+WV/7AxEHxhe+W6RAYxH+D/sERsVzivRhrpTwmCM2HE+1H9uzrNLR53GAtaQUQkIy03iBK84AZqqkbjLiH6TtYxXmbMvyNXzoqluhI8wbeUQRGgV5sOCtlgc1kwoP5kVc0kzEB+z90hTRRhUXtTcaflcXHMDnit6IAatvBvlf0nZT3tVDfZwZgN8/W4WDzg4epfkU+yGKpfCkdfW0c/5BvD3UY+V9XNi0N3QM//axbxMgpHfScSwamWnfM9068VT4O6ph0oxSg2gJL0mJ2mbawhuCn0 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:(4636009)(36840700001)(46966006)(508600001)(6506007)(5660300002)(47076005)(2906002)(356005)(336012)(316002)(9686003)(7696005)(8676002)(52536014)(83380400001)(110136005)(186003)(107886003)(70206006)(26005)(55016003)(8936002)(966005)(86362001)(33656002)(82310400004)(4326008)(70586007)(36860700001)(81166007)(133343001); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2022 13:09:38.4645 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4af5f7a0-f175-4795-08b7-08d9d43a74f0 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: DB5EUR03FT046.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7195 X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Mon, 10 Jan 2022 13:09:42 -0000 Hi Florian,=0A= =0A= >>> These implementations are incorrect. There may be a mismatch in s1/s2= =0A= >>> before invalid memory but no null CHAR / length boundary.=0A= >>=0A= >> This is not true, see=0A= >> eg. https://en.cppreference.com/w/cpp/string/byte/strcmp.=A0 Most string= =0A= >> functions require that the string is correctly terminated. There are=0A= >> only a few exceptions (memchr IIRC), and several generic=0A= >> implementations use strlen or strnlen before the main loop.=0A= >=0A= > I am not sure if those are bugs.=A0 Don't we support non-array usage in= =0A= > these functions as an extension?=A0 At least for strncmp and strnlen and= =0A= > their wide counterparts.=A0 C11 is pretty clear that strncmp operates on= =0A= > arrays, so this is an extension.=0A= =0A= My concern is about being able to read beyond a mismatch (which you have=0A= to anyway when you process more than 1 character per iteration) rather than= =0A= reading beyond the end of a string or array.=0A= =0A= What do you mean with non-array usage? Reading beyond the size parameter=0A= in a strn* function if a NUL terminator has not been found yet? Or not stop= ping=0A= at NUL before the size?=0A= =0A= Wilco=0A= =0A= =0A= =0A=