From 28786eb269888fdf850340a60e941ae3d0ee1d24 Mon Sep 17 00:00:00 2001 From: "Wang, Xiang W" Date: Wed, 27 Mar 2019 11:38:48 -0400 Subject: [PATCH] Rose: extend handling for unexpected logical combination programs --- src/runtime.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/runtime.c b/src/runtime.c index 9a42dafb..49346311 100644 --- a/src/runtime.c +++ b/src/runtime.c @@ -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; + } } }