]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
knownConditionTrueFalse fixes previously fp 263/head
authorgtsoul-tech <gtsoulkanakis@gmail.com>
Thu, 2 May 2024 07:13:55 +0000 (10:13 +0300)
committergtsoul-tech <gtsoulkanakis@gmail.com>
Thu, 2 May 2024 07:13:55 +0000 (10:13 +0300)
src/nfa/repeat.c
src/rose/rose_build_bytecode.cpp
unit/internal/fdr_flood.cpp
unit/internal/flat_set.cpp
unit/internal/insertion_ordered.cpp

index 5b2e4df4ed58f80fab6b97d0e6b0ac7feddab90d..07d02082fa674446a0fca305fa52a268369c486b 100644 (file)
@@ -785,7 +785,7 @@ enum RepeatMatch repeatHasMatchRange(const struct RepeatInfo *info,
     if (diff > info->repeatMax) {
         DEBUG_PRINTF("range list is stale\n");
         return REPEAT_STALE;
-    } else if (diff >= info->repeatMin && diff <= info->repeatMax) {
+    } else if (diff >= info->repeatMin) {
         return REPEAT_MATCH;
     }
 
@@ -836,7 +836,7 @@ enum RepeatMatch repeatHasMatchBitmap(const struct RepeatInfo *info,
     if (diff > info->repeatMax) {
         DEBUG_PRINTF("stale\n");
         return REPEAT_STALE;
-    } else if (diff >= info->repeatMin && diff <= info->repeatMax) {
+    } else if (diff >= info->repeatMin) {
         return REPEAT_MATCH;
     }
 
index 639edddcd8c9e943fbda17fd494cbd318030be54..181d77e5a551c2338d7925e764dbe02973496838 100644 (file)
@@ -1495,7 +1495,7 @@ void findExclusiveInfixes(RoseBuildImpl &build, build_context &bc,
 }
 
 static
-bool buildLeftfixes(RoseBuildImpl &tbi, build_context &bc,
+void buildLeftfixes(RoseBuildImpl &tbi, build_context &bc,
                     QueueIndexFactory &qif, set<u32> *no_retrigger_queues,
                     set<u32> *eager_queues, bool do_prefix) {
     RoseGraph &g = tbi.g;
@@ -1581,7 +1581,7 @@ bool buildLeftfixes(RoseBuildImpl &tbi, build_context &bc,
                      leftfix);
     }
 
-    return true;
+    return ;
 }
 
 static
@@ -2059,16 +2059,8 @@ bool buildNfas(RoseBuildImpl &tbi, build_context &bc, QueueIndexFactory &qif,
     suffixTriggers.clear();
 
     *leftfixBeginQueue = qif.allocated_count();
-
-    if (!buildLeftfixes(tbi, bc, qif, no_retrigger_queues, eager_queues,
-                        true)) {
-        return false;
-    }
-
-    if (!buildLeftfixes(tbi, bc, qif, no_retrigger_queues, eager_queues,
-                        false)) {
-        return false;
-    }
+    buildLeftfixes(tbi, bc, qif, no_retrigger_queues, eager_queues,true);
+    buildLeftfixes(tbi, bc, qif, no_retrigger_queues, eager_queues,false);
 
     return true;
 }
index 77d3ff47934ce20a8e5f97cf684de9e438a1ea17..fd8a9734856e1bd1e57f9a67f184e9fccc189867 100644 (file)
@@ -154,7 +154,7 @@ TEST_P(FDRFloodp, NoMask) {
 
     struct hs_scratch scratch;
     scratch.fdr_conf = NULL;
-    while (1) {
+    while (c != 255) {
         SCOPED_TRACE((unsigned int)c);
         u8 bit = 1 << (c & 0x7);
         u8 cAlt = c ^ bit;
@@ -233,9 +233,7 @@ TEST_P(FDRFloodp, NoMask) {
         }
         matchesCounts.clear();
 
-        if (++c == 0) {
-            break;
-        }
+        ++c;
     }
 }
 
@@ -248,7 +246,7 @@ TEST_P(FDRFloodp, WithMask) {
 
     struct hs_scratch scratch;
     scratch.fdr_conf = NULL;
-    while (1) {
+    while (c != 255) {
         u8 bit = 1 << (c & 0x7);
         u8 cAlt = c ^ bit;
         SCOPED_TRACE((unsigned int)c);
@@ -396,9 +394,7 @@ TEST_P(FDRFloodp, WithMask) {
         }
         matchesCounts.clear();
 
-        if (++c == '\0') {
-            break;
-        }
+        ++c;
     }
 }
 
@@ -414,7 +410,7 @@ TEST_P(FDRFloodp, StreamingMask) {
 
     struct hs_scratch scratch;
     scratch.fdr_conf = NULL;
-    while (1) {
+    while (c != 255) {
         u8 bit = 1 << (c & 0x7);
         u8 cAlt = c ^ bit;
         SCOPED_TRACE((unsigned int)c);
@@ -548,9 +544,7 @@ TEST_P(FDRFloodp, StreamingMask) {
             }
         }
 
-        if (++c == '\0') {
-            break;
-        }
+        ++c;
     }
     matchesCounts.clear();
 }
index 10607a6fb04b4c21eaa9daaad3a0d774e2d3751d..174a4771d092eeca2c68726524261fa79b4b1960 100644 (file)
@@ -48,9 +48,7 @@ std::ostream &operator<<(std::ostream &os, const flat_set<T> &f) {
     os << "{";
     for (auto it = begin(f); it != end(f); ++it) {
         os << *it;
-        if (it != end(f)) {
-            os << ", ";
-        }
+        os << ", ";
     }
     os << "}";
     return os;
index 6026ce1d7818f5aa21fb7332c3d8ee134f21ad4d..2d799aa996bf1aead8e3e0263e1b92d688e67ef3 100644 (file)
@@ -149,9 +149,7 @@ std::ostream &operator<<(std::ostream &os, const insertion_ordered_set<K> &s) {
     os << "{";
     for (auto it = begin(s); it != end(s); ++it) {
         os << *it;
-        if (it != end(s)) {
-            os << ", ";
-        }
+        os << ", ";
     }
     os << "}";
     return os;