From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 0303B3858404 for ; Thu, 4 Apr 2024 16:34:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0303B3858404 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0303B3858404 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712248444; cv=none; b=WOtIFtAsxjGEwb5VmC6PP3fCPvrVqY9KKW0DRkhNCEhkjZU8TqYl9M8khYpVp0rensPTFR2Pw6wU7lsJRBfNXMna6nqRhiUp6fm/i83rxP/M5bkExAKAlsml1yYdt9HliHEUHau/h9TCi1VX63arZAm82SknVMW/qS0/gck0heE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712248444; c=relaxed/simple; bh=2O6z0C2hDhSVbY+osVnYfo6D8UMVHMhdB+fYUczjeig=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=kwi+U62ngvublXxk4xwSlV+nOas8rtuvoxbVvGwEe//ydetcGMfMPhRF3/yDXcdjwJxTcainAj5CwpMo5DvcsmBc5ecz+7gXVqz1jl654bxEN5GgW+H1qa39gHEQxcbN41wg+AJb3dhUYWV13RvKCjxezBYIapoV3Op81i02rfY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712248440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IyeYeE/61iKlAfjUGcV2HkvRotLYdWyw5UFK3d+tjC4=; b=gtu55+XC4xauLt9nllgKZI8WeYOFFlGMz8VoNro+M2vQlg+QLrtU10I75GXwcXFJQU9YcD do4MaDWdfOXK+RApRIH/dItwJFLOBVPyquHKDQy7XFw2gA7e957WEV10uU/NCN7/GUWf8w Bvb6jWn5ueimxUiu5V5B2ZbKWHoog44= Received: from mail-yb1-f200.google.com (mail-yb1-f200.google.com [209.85.219.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-94-50AIjsUNO-u6ml3Fij6bFQ-1; Thu, 04 Apr 2024 12:33:59 -0400 X-MC-Unique: 50AIjsUNO-u6ml3Fij6bFQ-1 Received: by mail-yb1-f200.google.com with SMTP id 3f1490d57ef6-ddaf2f115f2so1753891276.3 for ; Thu, 04 Apr 2024 09:33:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712248438; x=1712853238; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IyeYeE/61iKlAfjUGcV2HkvRotLYdWyw5UFK3d+tjC4=; b=pWvFUBDLDEiu3riJGMrTEY31jGX0yxnL7PVftD/D6lP/avpbQvNTc2WKC2ZUCyIWmz 5a9RvTM5rGID/sZ/3jvfQ+QGQU8HR/xTAxcd8aWMVBbOpZIwedNRk1zG9aJAYzkgb3Qw Ff/+BAtlWcAUt8n4653u/BjiYNzzgtqodWbly4QFRqIiiSE7kuEjEAYQgYW0W5XuK2+v x4bYnaMiGx0+Q/zlBwi+XqSUDh4L0UKTbCiUfo6YyElF9/cLKkqHK6hF3kJfasriSHSh JTfUn5EZ7H6gp/QE4Q8GiOHmNaoLVbKLdOnB0400IJ8Gsc62XWiV5PZroSBcAqED5an8 fzgw== X-Gm-Message-State: AOJu0YwP/AeKX/E5c1vM6sjnsguzhUzrUzqxLLMoalCrYx8KbNIIl5Fi wnbUfJl2WIZpuXeCtnNd3UxANl7S/EidvbNeoZjWFhfXcFkgQvGYnA2boi7SBGvNp7+amlVUf50 5/8hDKTJ+w5mHFzF11kyFhqScCBRnsjCdLEJe2piBDgrW6FfLccOW4lP1siSp0Rdvvla6JHqcSs WpNzxWKxSVhRTTmIkvI+sJaNsLyX4= X-Received: by 2002:a25:8189:0:b0:dc2:3936:5fa5 with SMTP id p9-20020a258189000000b00dc239365fa5mr2659725ybk.51.1712248438533; Thu, 04 Apr 2024 09:33:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHNjHWi3hcUi95aQSzDlTrrOlssxP5r1Ck4HHKQ3Wn28GBrU2kpqTVRqTw0aQFakmvF4CsZNSypdbKB6mr3/LM= X-Received: by 2002:a25:8189:0:b0:dc2:3936:5fa5 with SMTP id p9-20020a258189000000b00dc239365fa5mr2659713ybk.51.1712248438309; Thu, 04 Apr 2024 09:33:58 -0700 (PDT) MIME-Version: 1.0 References: <20240404153158.313297-1-jwakely@redhat.com> In-Reply-To: From: Jonathan Wakely Date: Thu, 4 Apr 2024 17:33:42 +0100 Message-ID: Subject: Re: [PATCH] libstdc++: Fix infinite loop in std::istream::ignore(n, delim) [PR93672] To: Ulrich Drepper Cc: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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 List-Id: On Thu, 4 Apr 2024 at 17:29, Ulrich Drepper wrote: > > On Thu, Apr 4, 2024 at 5:29=E2=80=AFPM Jonathan Wakely wrote: > > I would appreciate more eyes on this to confirm my conclusions about > > negative int_type values, and the proposed fix, make sense. > > The way something like this is handled in glibc's ctype functions is > that both branches are considered. For isXXX(c) whether c is -v or > 256-v the same value is returned (except for EOF which is -1). This > caused the least number of bad surprises. > > You could here also perform similar actions. Yes, my first attempt to fix PR93672 did exactly that, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D93672#c1 But since it doesn't work for '\xff' (because that's EOF when char is signed) it only handles 127 of the 128 possible bugs ;-) I'm also not sure it's conforming, since the standard specifies how the matching is done, and that won't match negative chars.