From b9cdb4d76fd9036fe47f60268f704b58ae12cbb3 Mon Sep 17 00:00:00 2001 From: dreamsourcelabTAI Date: Thu, 6 Jul 2023 16:11:48 +0800 Subject: [PATCH] fix: The edge search position out of range, so the finding loop can't break --- DSView/pv/data/logicsnapshot.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/DSView/pv/data/logicsnapshot.cpp b/DSView/pv/data/logicsnapshot.cpp index e4e5d35d..36b0ef25 100644 --- a/DSView/pv/data/logicsnapshot.cpp +++ b/DSView/pv/data/logicsnapshot.cpp @@ -1236,8 +1236,8 @@ bool LogicSnapshot::pattern_search_self(int64_t start, int64_t end, int64_t &ind int count = 0; bool bEdgeFlag = false; - int64_t to = isNext ? end + 1 : start - 1; - int64_t step = isNext ? 1 : -1; + const int64_t to = isNext ? end + 1 : start - 1; + const int64_t step = isNext ? 1 : -1; for (auto it = pattern.begin(); it != pattern.end(); it++){ char flag = *(it->second.toStdString().c_str()); @@ -1270,6 +1270,13 @@ bool LogicSnapshot::pattern_search_self(int64_t start, int64_t end, int64_t &ind index += step; } + if (index < start){ + index = start; + } + if (index > end){ + index = end; + } + while (index != to) { macthed = 0;