On Mon, 04 Feb 2019 14:06:22 -0800, enh wrote:

> it seems like OpenBSD did cherrypick this FreeBSD regex fix...
>
> https://github.com/freebsd/freebsd/commit/981dd2aa38f37e4d0dd86225c619e900fc0
> 3d82e#diff-d7c26714f9432399b202eefcedb97491
>
> ...but not this one, which also seems to apply to the OpenBSD copy of the cod
> e?
>
> https://github.com/freebsd/freebsd/commit/95b1feb22b6da0549367ed0023308f0abfa
> 8086b#diff-d7c26714f9432399b202eefcedb97491

Here's a diff relative to our regcomp.c.

 - todd

Index: lib/libc/regex/regcomp.c
===================================================================
RCS file: /cvs/src/lib/libc/regex/regcomp.c,v
retrieving revision 1.32
diff -u -p -u -r1.32 regcomp.c
--- lib/libc/regex/regcomp.c    30 Oct 2017 06:48:20 -0000      1.32
+++ lib/libc/regex/regcomp.c    5 Feb 2019 16:42:55 -0000
@@ -353,6 +353,8 @@ p_ere_exp(struct parse *p)
                REQUIRE(!MORE() || !isdigit((uch)PEEK()), REG_BADRPT);
                /* FALLTHROUGH */
        default:
+               if (p->error != 0)
+                       return;
                ordinary(p, c);
                break;
        }
@@ -555,6 +557,8 @@ p_simp_re(struct parse *p,
                REQUIRE(starordinary, REG_BADRPT);
                /* FALLTHROUGH */
        default:
+               if (p->error != 0)
+                       return;
                ordinary(p, (char)c);
                break;
        }

Reply via email to