mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
Logical Combination: avoid corruption of pending combination report
in streaming mode. Fixes github issue #165
This commit is contained in:
parent
1f4c10a58d
commit
64ea43ea39
@ -480,6 +480,25 @@ hwlmcb_rv_t roseReport(const struct RoseEngine *t, struct hs_scratch *scratch,
|
|||||||
return roseHaltIfExhausted(t, scratch);
|
return roseHaltIfExhausted(t, scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static rose_inline
|
||||||
|
hwlmcb_rv_t roseReportComb(const struct RoseEngine *t,
|
||||||
|
struct hs_scratch *scratch, u64a end,
|
||||||
|
ReportID onmatch, s32 offset_adjust, u32 ekey) {
|
||||||
|
DEBUG_PRINTF("firing callback onmatch=%u, end=%llu\n", onmatch, end);
|
||||||
|
|
||||||
|
int cb_rv = roseDeliverReport(end, onmatch, offset_adjust, scratch, ekey);
|
||||||
|
if (cb_rv == MO_HALT_MATCHING) {
|
||||||
|
DEBUG_PRINTF("termination requested\n");
|
||||||
|
return HWLM_TERMINATE_MATCHING;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ekey == INVALID_EKEY || cb_rv == ROSE_CONTINUE_MATCHING_NO_EXHAUST) {
|
||||||
|
return HWLM_CONTINUE_MATCHING;
|
||||||
|
}
|
||||||
|
|
||||||
|
return roseHaltIfExhausted(t, scratch);
|
||||||
|
}
|
||||||
|
|
||||||
/* catches up engines enough to ensure any earlier mpv triggers are enqueued
|
/* catches up engines enough to ensure any earlier mpv triggers are enqueued
|
||||||
* and then adds the trigger to the mpv queue. */
|
* and then adds the trigger to the mpv queue. */
|
||||||
static rose_inline
|
static rose_inline
|
||||||
@ -1866,8 +1885,8 @@ hwlmcb_rv_t flushActiveCombinations(const struct RoseEngine *t,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_PRINTF("Logical Combination Passed!\n");
|
DEBUG_PRINTF("Logical Combination Passed!\n");
|
||||||
if (roseReport(t, scratch, end, ci->id, 0,
|
if (roseReportComb(t, scratch, end, ci->id, 0,
|
||||||
ci->ekey) == HWLM_TERMINATE_MATCHING) {
|
ci->ekey) == HWLM_TERMINATE_MATCHING) {
|
||||||
return HWLM_TERMINATE_MATCHING;
|
return HWLM_TERMINATE_MATCHING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1910,8 +1929,8 @@ hwlmcb_rv_t checkPurelyNegatives(const struct RoseEngine *t,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_PRINTF("Logical Combination from purely negative Passed!\n");
|
DEBUG_PRINTF("Logical Combination from purely negative Passed!\n");
|
||||||
if (roseReport(t, scratch, end, ci->id, 0,
|
if (roseReportComb(t, scratch, end, ci->id, 0,
|
||||||
ci->ekey) == HWLM_TERMINATE_MATCHING) {
|
ci->ekey) == HWLM_TERMINATE_MATCHING) {
|
||||||
return HWLM_TERMINATE_MATCHING;
|
return HWLM_TERMINATE_MATCHING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -652,7 +652,9 @@ void report_eod_matches(hs_stream_t *id, hs_scratch_t *scratch,
|
|||||||
scratch->core_info.logicalVector = state +
|
scratch->core_info.logicalVector = state +
|
||||||
rose->stateOffsets.logicalVec;
|
rose->stateOffsets.logicalVec;
|
||||||
scratch->core_info.combVector = state + rose->stateOffsets.combVec;
|
scratch->core_info.combVector = state + rose->stateOffsets.combVec;
|
||||||
scratch->tctxt.lastCombMatchOffset = id->offset;
|
if (!id->offset) {
|
||||||
|
scratch->tctxt.lastCombMatchOffset = id->offset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rose->somLocationCount) {
|
if (rose->somLocationCount) {
|
||||||
@ -908,7 +910,9 @@ hs_error_t hs_scan_stream_internal(hs_stream_t *id, const char *data,
|
|||||||
scratch->core_info.logicalVector = state +
|
scratch->core_info.logicalVector = state +
|
||||||
rose->stateOffsets.logicalVec;
|
rose->stateOffsets.logicalVec;
|
||||||
scratch->core_info.combVector = state + rose->stateOffsets.combVec;
|
scratch->core_info.combVector = state + rose->stateOffsets.combVec;
|
||||||
scratch->tctxt.lastCombMatchOffset = id->offset;
|
if (!id->offset) {
|
||||||
|
scratch->tctxt.lastCombMatchOffset = id->offset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
assert(scratch->core_info.hlen <= id->offset
|
assert(scratch->core_info.hlen <= id->offset
|
||||||
&& scratch->core_info.hlen <= rose->historyRequired);
|
&& scratch->core_info.hlen <= rose->historyRequired);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user