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=-1.0 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10280 invoked from network); 25 Dec 2021 03:11:00 -0000 Received: from tb-ob1.topicbox.com (64.147.108.173) by inbox.vuxu.org with ESMTPUTF8; 25 Dec 2021 03:11:00 -0000 Received: from tb-mx0.topicbox.com (tb-mx0.nyi.icgroup.com [10.90.30.73]) by tb-ob1.topicbox.com (Postfix) with ESMTP id B161F2F12D for ; Fri, 24 Dec 2021 22:10:56 -0500 (EST) (envelope-from bounce.mMff16469136bde42ef0336be5.r522be890-2105-11eb-b15e-8d699134e1fa@9fans.bounce.topicbox.com) Received: by tb-mx0.topicbox.com (Postfix, from userid 1132) id AC741D37B84; Fri, 24 Dec 2021 22:10:56 -0500 (EST) ARC-Authentication-Results: i=2; topicbox.com; arc=pass; dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=YfWIL+9u header.a=rsa-sha256 header.s=20210112 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; spf=pass smtp.mailfrom=conor.williams@gmail.com smtp.helo=mail-ot1-f54.google.com; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (message has been altered)) (Message modified while forwarding at Topicbox) ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type:list-help:list-id:list-post :list-subscribe:reply-to:content-transfer-encoding :list-unsubscribe; s=sysmsg-1; t=1640401856; bh=mwI94M5/sQyLgNAJ eWX4dmL81AeqCpqcxNxX3H2rI4E=; b=BnZCEEb+tB5jyaHdKmT/cGRpwmkyFgNR D4O4QdBi7QqAp5RNd/7KgvhbIQ4sUeEZl5FhmBtJ36eotjGu10VNJj7rkVvq3mRh AFP+SsFhk8+HTBY/X82vP0PwZax4aHLZcwjE2GEa2DGAMoXeRHXLwkqIbSOLXMnH F2sn6Bh75DA= ARC-Seal: i=2; a=rsa-sha256; cv=pass; d=topicbox.com; s=sysmsg-1; t= 1640401856; b=byygTwo9GBhao1xFt5crgYMf2ZRoPp2ZOszO3C3IJybQf1jM7b p28p7UfTyH+QdPl8I1KWAZJW6acuKdKSLlEoXgcRBXbpBqqh+bXe73rumFpuKQrz 2gldK2fS7cWCXGGclFfFclzDRvTCTyzDRQapItBVGw4DNvIaEWaxl6Tk0= Authentication-Results: topicbox.com; arc=pass; dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=YfWIL+9u header.a=rsa-sha256 header.s=20210112 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; spf=pass smtp.mailfrom=conor.williams@gmail.com smtp.helo=mail-ot1-f54.google.com; x-internal-arc=fail (as.1.topicbox.com=pass, ams.1.topicbox.com=fail (message has been altered)) (Message modified while forwarding at Topicbox) X-Received-Authentication-Results: tb-mx1.topicbox.com; arc=none (no signatures found); bimi=skipped (DMARC Policy is not at enforcement); dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=YfWIL+9u header.a=rsa-sha256 header.s=20210112 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; iprev=pass smtp.remote-ip=209.85.210.54 (mail-ot1-f54.google.com); spf=pass smtp.mailfrom=conor.williams@gmail.com smtp.helo=mail-ot1-f54.google.com; x-aligned-from=pass (Address match); x-google-dkim=pass (2048-bit rsa key) header.d=1e100.net header.i=@1e100.net header.b=ERmd3KNX; x-me-sender=none; x-ptr=pass smtp.helo=mail-ot1-f54.google.com policy.ptr=mail-ot1-f54.google.com; x-return-mx=pass header.domain=gmail.com policy.is_org=yes (MX Records found: alt4.gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com); x-return-mx=pass smtp.domain=gmail.com policy.is_org=yes (MX Records found: alt4.gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=9fans.net; h= mime-version:references:in-reply-to:from:date:message-id:subject :to:content-type:list-help:list-id:list-post:list-subscribe :reply-to:content-transfer-encoding:list-unsubscribe; s=dkim-1; bh=EQ2BLziz/7YIzTjuongkwccdv9aBt1R/jalVCfcc6L4=; b=qGixueTq5Qf4 STlwX+zx7eVJ+5adFFd8N9ijU8Snp9Gnv5Hi1oyKZkJKALHl5SKZ5S+CFxi6iluL KCwX9RAdOZ2HR9MKhMfPSU1toVOnVU4hCcHx4x30p5/2NfPzrubO6OgtfJXs+UHK MyyEENT9dIVTLJrYm4IUSaMTI5H82/I= Received: from tb-mx1.topicbox.com (localhost.local [127.0.0.1]) by tb-mx1.topicbox.com (Postfix) with ESMTP id 3D1B5BE154F for <9fans@9fans.net>; Fri, 24 Dec 2021 22:10:40 -0500 (EST) (envelope-from conor.williams@gmail.com) Received: from tb-mx1.topicbox.com (localhost [127.0.0.1]) by tb-mx1.topicbox.com (Authentication Milter) with ESMTP id 460B55FD600; Fri, 24 Dec 2021 22:10:40 -0500 ARC-Seal: i=1; a=rsa-sha256; cv=none; d=topicbox.com; s=arcseal; t= 1640401840; b=rJgkqKnvTRsQw7+zV5aOwTYPLfUFE7Q/3yTslbkvp2XBYIo5Rq LK+xg9TEvh6hJ2PjcFdyJJGlzm5ZLJw9y40PquWwL27DagOfFFm20BNrVos/vOsL 3Zn2Vl3dHadDX7FafVkRQFsEt5kJDbEcqASBgEiQSf7pVAOrjDxLk8vY5TIg+Apd gLzkqk2gJDO0R93jPCexBqCDYm7VTltGLU0iPFLNFaVOl9ekPupCEusfAtwXbU02 wA5Vg8tU4FSXLjKhcE12TFM9A0klPt/+oKyV9dGgp4m5t+RPvH6nHr/jrujDxzAC yim2Mp2XMwMsE29RTYiNDgy0biXvvfpBPLog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= topicbox.com; h=mime-version:references:in-reply-to:from:date :message-id:subject:to:content-type; s=arcseal; t=1640401840; bh=IrSNy6S+GMc83n4cbsrj38nKfSRyyFhwM2u68o2EsiY=; b=J9XXZrQReT/Z 8jI39bOOvbL7fllZdu+JvaZL3HUFWyxzWjpW3LGc9HPJEhO0RzLwTTI4bP0U5jg1 3F5jM4YrajmHQeA3NIhPTCA5D7TcFdJsqCJlJ4tzI3jYtEKwPEE4YF18RJTC1b9U nkAELUs52w3GdWxgYXyfqzMI2fJQ03VMB0+2YTW8W74UqcUmO5IIzuJezwvlybyz onSHEvSGoLih3tl3eCpXUsIx65HygclY7ZUQts8+wJikIqT12Wjnx8SqINsoMCUV QG5ei8olqbgfjRLo9ITKgq0MhdW/mTDJoWBYRTf3z+QcSm31+hRf5N0D8OHGc7mU /egC4j61nw== ARC-Authentication-Results: i=1; tb-mx1.topicbox.com; arc=none (no signatures found); bimi=skipped (DMARC Policy is not at enforcement); dkim=pass (2048-bit rsa key sha256) header.d=gmail.com header.i=@gmail.com header.b=YfWIL+9u header.a=rsa-sha256 header.s=20210112 x-bits=2048; dmarc=pass policy.published-domain-policy=none policy.published-subdomain-policy=quarantine policy.applied-disposition=none policy.evaluated-disposition=none (p=none,sp=quarantine,d=none,d.eval=none) policy.policy-from=p header.from=gmail.com; iprev=pass smtp.remote-ip=209.85.210.54 (mail-ot1-f54.google.com); spf=pass smtp.mailfrom=conor.williams@gmail.com smtp.helo=mail-ot1-f54.google.com; x-aligned-from=pass (Address match); x-google-dkim=pass (2048-bit rsa key) header.d=1e100.net header.i=@1e100.net header.b=ERmd3KNX; x-me-sender=none; x-ptr=pass smtp.helo=mail-ot1-f54.google.com policy.ptr=mail-ot1-f54.google.com; x-return-mx=pass header.domain=gmail.com policy.is_org=yes (MX Records found: alt4.gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com); x-return-mx=pass smtp.domain=gmail.com policy.is_org=yes (MX Records found: alt4.gmail-smtp-in.l.google.com,alt2.gmail-smtp-in.l.google.com,alt1.gmail-smtp-in.l.google.com,gmail-smtp-in.l.google.com,alt3.gmail-smtp-in.l.google.com); x-tls=pass smtp.version=TLSv1.2 smtp.cipher=ECDHE-RSA-AES256-GCM-SHA384 smtp.bits=256/256; x-vs=clean score=0 state=0 X-ME-VSCause: gggruggvucftvghtrhhoucdtuddrgedvuddrudduuddgheduucdltddurdegudelrddttd dmucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgf nhhsuhgsshgtrhhisggvpdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttd enucenucfjughrpeggfhgjhfffkffuvfgtsegrtderredttdejnecuhfhrohhmpeevohhn ohhrucghihhllhhirghmshcuoegtohhnohhrrdifihhllhhirghmshesghhmrghilhdrtg homheqnecuggftrfgrthhtvghrnheptdetvedtgeelgfdvuddtheeitdegffehjeffleet jeetjeelveejgfeuhefhveehnecuffhomhgrihhnpehfrhgvvghshhgvlhhlrdhorhhgpd htohhpihgtsghogidrtghomhenucfkphepvddtledrkeehrddvuddtrdehgeenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpedvtdelrdekhedrvddutddrhe egpdhhvghlohepmhgrihhlqdhothduqdhfheegrdhgohhoghhlvgdrtghomhdpmhgrihhl fhhrohhmpeeotghonhhorhdrfihilhhlihgrmhhssehgmhgrihhlrdgtohhmqe X-ME-VSScore: 0 X-ME-VSCategory: clean Received-SPF: pass (gmail.com ... _spf.google.com: Sender is authorized to use 'conor.williams@gmail.com' in 'mfrom' identity (mechanism 'include:_netblocks.google.com' matched)) receiver=tb-mx1.topicbox.com; identity=mailfrom; envelope-from="conor.williams@gmail.com"; helo=mail-ot1-f54.google.com; client-ip=209.85.210.54 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tb-mx1.topicbox.com (Postfix) with ESMTPS for <9fans@9fans.net>; Fri, 24 Dec 2021 22:10:39 -0500 (EST) (envelope-from conor.williams@gmail.com) Received: by mail-ot1-f54.google.com with SMTP id n17-20020a9d64d1000000b00579cf677301so12989062otl.8 for <9fans@9fans.net>; Fri, 24 Dec 2021 19:10:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=IrSNy6S+GMc83n4cbsrj38nKfSRyyFhwM2u68o2EsiY=; b=ERmd3KNXg06lZMA4rYrtFb5e4+eFgeGi4Kbp8iJeOrtViAaE3FM36bl+PLP9MfOsrr CXZZwihUNr9bmy/HUqM17k59QYen7T8bazPbmSGLKBufJ7pgDRWBs5B+1e0ys3HGyHTB HIxc5FFuE/FHYtNAxOaHTOlPQkG0HTJJ3uZpHuO6SXBDu6YjwJlV6Zkqja6l8D06AUdd BqmKELjRjIzzzQ7jpFJPVx8/0CMBUnJeS7xRq8VbtwcPi924XRylGLlwinwqPbgMchtH JTLLPGDS+Zuzl1RcQS38w9LCqIkWVOQOaRlXnh43ekuTvnCsNDonxu6Kv3ceNWSpHcJm 2xrQ== X-Gm-Message-State: AOAM532GCfRalLQ8A3bJG/n6IwGWZnyW2PXhiY9kqJKfS4iz44DPRe23 VKXqDR9Sdqh03l7q0OfXXF7acASDYuixkP+VjLOBd5KI X-Google-Smtp-Source: ABdhPJxC/X/qDKDpGBiC0jpl6Fdt4rxsbxAqo/VNn3IM7TAcycobYA5voRy8P5V975Du7NXlmzRFz4QyEL9vZcom1Zw= X-Received: by 2002:a9d:578c:: with SMTP id q12mr6478005oth.244.1640401838796; Fri, 24 Dec 2021 19:10:38 -0800 (PST) MIME-Version: 1.0 References: <171b6946-5a63-f723-b2c9-713ffcfea9e@SDF.ORG> In-Reply-To: <171b6946-5a63-f723-b2c9-713ffcfea9e@SDF.ORG> From: Conor Williams Date: Sat, 25 Dec 2021 03:10:26 +0000 Message-ID: Subject: Re: [9fans] Fix sam regexp bug with metacharacters in classes To: 9fans <9fans@9fans.net> Content-Type: multipart/alternative; boundary=000000000000e3f0d905d3efd03c Topicbox-Policy-Reasoning: allow: sender is a member Topicbox-Message-UUID: 40034ea4-6530-11ec-8bb8-9a37c4634afe Archived-At: =?UTF-8?B?PGh0dHBzOi8vOWZhbnMudG9waWNib3guY29tL2dyb3Vwcy85?= =?UTF-8?B?ZmFucy9UY2NiZGIyMGI2NzAwMDNhMS1NZmYxNjQ2OTEzNmJkZTQyZWYwMzM2?= =?UTF-8?B?YmU1Pg==?= List-Help: List-Id: "9fans" <9fans.9fans.net> List-Post: List-Software: Topicbox v0 List-Subscribe: Precedence: list Reply-To: 9fans <9fans@9fans.net> Content-Transfer-Encoding: 7bit List-Unsubscribe: , Topicbox-Delivery-ID: 2:9fans:437d30aa-c441-11e9-8a57-d036212d11b0:522be890-2105-11eb-b15e-8d699134e1fa:Mff16469136bde42ef0336be5:1:RdCnhdSWKCeceqZj1u7SuOYZApTgtTSW6dFMN-gRA4M --000000000000e3f0d905d3efd03c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable hi Adr Can you send me both the files, please? Kind Reards Conor P. Williams (conor.williams@gmail.com) ps: before I apply the patch... On Tue, Nov 23, 2021 at 8:27 PM adr wrote: > The code assumes runes are 16 bits long, not 21, creating faulting > code parsing classes. I.e. '/[\-]' will not match '-'. >=20 > This is the same fix already in 9front. >=20 > http://adr.freeshell.org/plan9/patches/sam_fix_metachars_on_classes.diff >=20 > --- /sys/src/cmd/sam/regexp.c Tue Apr 23 19:06:01 2013 > +++ regexp.c Tue Nov 23 15:01:18 2021 > @@ -53,8 +53,8 @@ > /* > * Actions and Tokens > * > - * 0x100xx are operators, value =3D=3D precedence > - * 0x200xx are tokens, i.e. operands for operators > + * 0x2000xx are operators, value =3D=3D precedence > + * 0x3000xx are tokens, i.e. operands for operators > */ > enum { > OPERATOR =3D Runemask+1, /* Bitmask of all operators */ > @@ -462,7 +462,8 @@ > exprp++; > return '\n'; > } > - return *exprp++|(Runemax+1); > + /* add a flag so metacharacters aren't interpreted */ > + return *exprp++|(Runemask+1); > } > return *exprp++; > } > @@ -498,11 +499,12 @@ > if((c2 =3D nextrec()) =3D=3D ']') > goto Error; > classp[n+0] =3D Runemax; > - classp[n+1] =3D c1; > - classp[n+2] =3D c2; > + /* remove possible flag from nextrec() */ > + classp[n+1] =3D c1 & Runemask; > + classp[n+2] =3D c2 & Runemask; > n +=3D 3; > }else > - classp[n++] =3D c1; > + classp[n++] =3D c1 & Runemask; > } > classp[n] =3D 0; > if(nclass =3D=3D Nclass){ >=20 ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tccbdb20b670003a1-Mff164= 69136bde42ef0336be5 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription --000000000000e3f0d905d3efd03c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
hi Adr

Can you send me bo= th the files, please?

Kind Reards
Cono= r P. Williams (conor.williams@g= mail.com)
ps: before I apply the patch...

On Tue, Nov = 23, 2021 at 8:27 PM adr <adr@sdf.org&= gt; wrote:
The= code assumes runes are 16 bits long, not 21, creating faulting
code parsing classes. I.e. '/[\-]' will not match '-'.

This is the same fix already in 9front.

http://adr.freeshell.org/plan9/patches/sam_fix_metac= hars_on_classes.diff

--- /sys/src/cmd/sam/regexp.c   Tue Apr 23 19:06:01 2013
+++ regexp.c    Tue Nov 23 15:01:18 2021
@@ -53,8 +53,8 @@
  /*
   * Actions and Tokens
   *
- *     0x100xx are operators, value =3D=3D precedence
- *     0x200xx are tokens, i.e. operands for operators
+ *     0x2000xx are operators, value =3D=3D precedence
+ *     0x3000xx are tokens, i.e. operands for operators
   */
  enum {
        OPERATOR =3D Runemask+1,  /* Bitmask of al= l operators */
@@ -462,7 +462,8 @@
                     = ;   exprp++;
                     = ;   return '\n';
                }
-               return *exprp++|(Ru= nemax+1);
+               /* add a flag so me= tacharacters aren't interpreted */
+               return *exprp++|(Ru= nemask+1);
        }
        return *exprp++;
  }
@@ -498,11 +499,12 @@
                     = ;   if((c2 =3D nextrec()) =3D=3D ']')
                     = ;           goto Error;
                     = ;   classp[n+0] =3D Runemax;
-                    &nbs= p;  classp[n+1] =3D c1;
-                    &nbs= p;  classp[n+2] =3D c2;
+                    &nbs= p;  /* remove possible flag from nextrec() */
+                    &nbs= p;  classp[n+1] =3D c1 & Runemask;
+                    &nbs= p;  classp[n+2] =3D c2 & Runemask;
                     = ;   n +=3D 3;
                }else
-                    &nbs= p;  classp[n++] =3D c1;
+                    &nbs= p;  classp[n++] =3D c1 & Runemask;
        }
        classp[n] =3D 0;
        if(nclass =3D=3D Nclass){


------------------------------------------
9fans: 9fans
Permalink: https:= //9fans.topicbox.com/groups/9fans/Tccbdb20b670003a1-M5d4e6bea6c6908b388e51f= 0c
Delivery options: https://9fans.topicbox.com/gro= ups/9fans/subscription
= --000000000000e3f0d905d3efd03c--