From 695fc3c5465ef1ea166eeba35dfdd883133efbd3 Mon Sep 17 00:00:00 2001 From: MarkLee131 Date: Mon, 30 Mar 2026 22:26:44 +0800 Subject: [PATCH] re2: fix mark deduplication flag in Workq::mark() Workq::mark() sets last_was_mark_ to false after inserting a mark. It should set it to true so that a subsequent call to mark() without an intervening insert() is correctly deduplicated. This is a correctness bug that affects longest-match mode. Duplicate marks can cause incorrect match priority ordering. --- re2/dfa.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/re2/dfa.cc b/re2/dfa.cc index d587a552..525bd407 100644 --- a/re2/dfa.cc +++ b/re2/dfa.cc @@ -388,7 +388,7 @@ class DFA::Workq : public SparseSet { void mark() { if (last_was_mark_) return; - last_was_mark_ = false; + last_was_mark_ = true; SparseSet::insert_new(nextmark_++); }