From 854144c5359648a66e11f74229b3aaf75c12cd5d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 4 Oct 2017 22:31:15 +0800 Subject: [PATCH] Regex: Fix handling of Save instruction in ThreadedRegexVM When not saving, we were not fully reading the instruction stream, leading to an out of sync instruction pointer. --- src/regex_impl.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/regex_impl.hh b/src/regex_impl.hh index 67d6f38b..f6f79baf 100644 --- a/src/regex_impl.hh +++ b/src/regex_impl.hh @@ -171,6 +171,7 @@ struct ThreadedRegexVM } case CompiledRegex::Save: { + const size_t index = *thread.inst++; if (thread.saves == nullptr) break; if (thread.saves->refcount > 1) @@ -178,7 +179,6 @@ struct ThreadedRegexVM --thread.saves->refcount; thread.saves = new_saves(thread.saves->pos); } - const size_t index = *thread.inst++; thread.saves->pos[index] = pos.base(); break; }