]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
Rose: extend handling for unexpected logical combination programs
authorWang, Xiang W <xiang.w.wang@intel.com>
Wed, 27 Mar 2019 15:38:48 +0000 (11:38 -0400)
committerWang Xiang W <xiang.w.wang@intel.com>
Wed, 10 Apr 2019 10:52:40 +0000 (06:52 -0400)
src/runtime.c

index 9a42dafb1ca0e03d5ec21f414c42378215c8f505..4934631143617dc1bc607df718d9fe8f1f015d09 100644 (file)
@@ -458,6 +458,10 @@ set_retval:
     if (rose->flushCombProgramOffset) {
         if (roseRunFlushCombProgram(rose, scratch, ~0ULL) == MO_HALT_MATCHING) {
             unmarkScratchInUse(scratch);
+            if (unlikely(internal_matching_error(scratch))) {
+                return HS_UNKNOWN_ERROR;
+            }
+
             return HS_SCAN_TERMINATED;
         }
     }
@@ -1011,6 +1015,10 @@ hs_error_t HS_CDECL hs_close_stream(hs_stream_t *id, hs_scratch_t *scratch,
         if (roseRunFlushCombProgram(id->rose, scratch, ~0ULL)
             == MO_HALT_MATCHING) {
             scratch->core_info.status |= STATUS_TERMINATED;
+            unmarkScratchInUse(scratch);
+            if (unlikely(internal_matching_error(scratch))) {
+                return HS_UNKNOWN_ERROR;
+            }
         }
     }
 
@@ -1046,6 +1054,10 @@ hs_error_t HS_CDECL hs_reset_stream(hs_stream_t *id, UNUSED unsigned int flags,
         if (roseRunFlushCombProgram(id->rose, scratch, ~0ULL)
             == MO_HALT_MATCHING) {
             scratch->core_info.status |= STATUS_TERMINATED;
+            unmarkScratchInUse(scratch);
+            if (unlikely(internal_matching_error(scratch))) {
+                return HS_UNKNOWN_ERROR;
+            }
         }
     }