From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 22882 invoked from network); 24 Dec 2020 22:27:09 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 24 Dec 2020 22:27:09 -0000 Received: (qmail 15550 invoked by uid 550); 24 Dec 2020 22:27:03 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 15526 invoked from network); 24 Dec 2020 22:27:02 -0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LfZq7a/f1A/pP00aLGK2xy12xln5LOOE3qelGL6mFFqyV0nACYJINEEn0SQBMVV88+c60A70SoR3ghutAZdD6hjXSBzG4gmteF/QfP8kv/xRmHgbACwNMzWmcQHdtaL0Otid3go0vSWyw0XbjGj2LWNAPP2LQwzadr7Y/DiV/jy3JcSn0gyuhOfgRCrr4d6HktDrBd1REJa/cG1kwgB0et+kc9a4AyYd/B7TLEaKJmNqA5FO5y4nvQvg0xP5deqyuKmKPHawtN2x9WMtq0bO7AFjalmn3F7E6BWsOfK9ZWokgUtGMOvv/iP5Z/p/1FYMfQB8t7WQo6qCEQBHbDJmzw== 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-SenderADCheck; bh=eVZTvx10Fs3hAFnI0qK8WbHVCowYxsXk0Zma3Rfer3c=; b=VwU4uSDkhKLVxIiT17yGNcaj8PL4dCTBjDGMMJvhZ3MYNMXVUYaeeNgslMCAlNMaG3f3Tsx6KFteLiBiHFMgotoc+iapffILEHVB2ORp955fpfimCM2bXHrd/MNQdGpM8qpFB01K5WYEJ9l+dCmPI2ssmNPFl0pccV35/FMuKPGlb6hgGQsldbPb6daNqRfth6ceLY0AOv5BdZ3a76a+RkHZqckBwB/yi9XDuDy3pTGZP0oGDEewJWe5AbLQzCtLjrXDMsso9tUM2i7urZLNUnjrI0LmnFrJwupQjUBvQg1iOggJTrrpIi4qsn29lrIrbybCcE29Gmi4vRBflRe1Yg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none X-IncomingTopHeaderMarker: OriginalChecksum:E7A1664E19EDD48AF15D576AF54B640F993EA72608A85A38C7630AF7F8F184C3;UpperCasedChecksum:69AE40343E7CDC2D1F6C07CAEF1FE430651FC5E8FE66071C2EA566572A1013BE;SizeAsReceived:9303;Count:49 X-Gm-Message-State: AOAM531rmdv/i/jFhGJVzazrw2Pu2BNO3vX0VHMu5DxmeiPnBA4JLzZ3 2vpYctWQ99q1sP+tkZmKUCoIpVmv55CMR/j1H/A= X-Google-Smtp-Source: ABdhPJy5A/W96fxXoInik0qrNe8Z/HPnrDqa9L6EvjHAH6461Ti3mII3RkxlhGzEwOzzhbrObVhJyIeGwNVLDm8HNDQ= X-Received: by 2002:a05:620a:947:: with SMTP id w7mr25604763qkw.389.1608848801185; Thu, 24 Dec 2020 14:26:41 -0800 (PST) References: <20201208193919.GA5522@spindle.one-eyed-alien.net> <20201208195327.GJ534@brightrain.aerifal.cx> <20201208224454.GB5522@spindle.one-eyed-alien.net> <20201208225717.GK534@brightrain.aerifal.cx> <20201209163728.GL534@brightrain.aerifal.cx> In-Reply-To: <20201209163728.GL534@brightrain.aerifal.cx> From: Fangrui Song Date: Thu, 24 Dec 2020 14:26:30 -0800 X-Gmail-Original-Message-ID: Message-ID: To: musl@lists.openwall.com Content-Type: text/plain; charset="UTF-8" X-TMN: [IQcsab2fQBbL+gVZzBXzLbdyc4g+83G4] X-ClientProxiedBy: BL1PR13CA0430.namprd13.prod.outlook.com (2603:10b6:208:2c3::15) To MWHPR1201MB0110.namprd12.prod.outlook.com (2603:10b6:301:56::8) X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 49 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 79b51639-557d-4070-649f-08d8a85afe38 X-MS-TrafficTypeDiagnostic: CO1NAM11HT003: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UWlWb4lQo4RaKqQR17pSgRNgp9MrvAYysVLC9cmzfucvHU9QET6TBou3hhJgSKo3P/KuuoYHUInI8edC7IzltgIZJqeP2oZLpsNjHToYvdvY4nD5sq6Cb2cS3tt4bvXAm743eZrXXdbLLE6P5pjbghUIP+gTqrEj2lXR5ppowGO08yTequdohvx8DtNbJWP/LXyfcLiNvoenNO+VXcctW9hA8Pn3Tir3DzrpC//GF4Et7C0ZOhJ6BuIpLSOl4WnN X-MS-Exchange-AntiSpam-MessageData: mkhGFHYmI/9pTegP5gllddRgV3FucMkg65XkG4OEgtrzneiDJIUqNGi6NfI9Qi7zjvzwSH//TkC1NmkzYLS4SJNSAQFr9BMI6XMlfgHHOxJ2vpqPT+CO64B+Pgar4bzErt7wHU8nNLS1pbWJgoURdw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Dec 2020 22:26:43.7607 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-Network-Message-Id: 79b51639-557d-4070-649f-08d8a85afe38 X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT008.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1NAM11HT003 Subject: Re: [musl] out-of-bounds reads in strstr On Wed, Dec 9, 2020 at 8:37 AM Rich Felker wrote: > > On Wed, Dec 09, 2020 at 09:54:51AM +0300, Alexander Monakov wrote: > > On Tue, 8 Dec 2020, Rich Felker wrote: > > > > > > That being said. I'm still confused by the comment in strstr. `l | 63` > > > > is closer to `MAX(l,63)` than `MIN(l,63)`. > > > > > > Yes, the comment is wrong. The point is just to scan at least l bytes > > > forward for the end of the haystack (since we'll need that many > > > immediately) and at least some decent minimum to avoid doing it over > > > and over if the needle is short. But there's no need for it to be > > > precise. > > > > It's not the first time this comes up. I suspect you'd save more time > > correcting the misleading comment instead of responding to each inquiry > > individually. > > Thanks for poking me again about this. Will do. > > Rich wcsstr.c has a similar typo.