mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
rose_build_matchers: fix fragment noruns calc
This commit is contained in:
parent
cc4a5cc36f
commit
2dc1f9d629
@ -556,6 +556,17 @@ bool isNoRunsLiteral(const RoseBuildImpl &build, const u32 id,
|
||||
return true;
|
||||
}
|
||||
|
||||
static
|
||||
bool isNoRunsFragment(const RoseBuildImpl &build, const LitFragment &f,
|
||||
const size_t max_len) {
|
||||
// For the fragment to be marked "no runs", every literal it fires must
|
||||
// need no further confirmation work.
|
||||
return all_of_in(f.lit_ids, [&](u32 lit_id) {
|
||||
const auto &info = build.literal_info.at(lit_id);
|
||||
return isNoRunsLiteral(build, lit_id, info, max_len);
|
||||
});
|
||||
}
|
||||
|
||||
static
|
||||
const raw_puff &getChainedPuff(const RoseBuildImpl &build,
|
||||
const Report &report) {
|
||||
@ -691,15 +702,15 @@ void addFragmentLiteral(const RoseBuildImpl &build, MatcherProto &mp,
|
||||
const LitFragment &f, u32 id, bool delay_rebuild,
|
||||
size_t max_len) {
|
||||
const rose_literal_id &lit = build.literals.at(id);
|
||||
assert(id < build.literal_info.size());
|
||||
const auto &info = build.literal_info.at(id);
|
||||
|
||||
DEBUG_PRINTF("lit='%s' (len %zu)\n", dumpString(lit.s).c_str(),
|
||||
lit.s.length());
|
||||
|
||||
vector<u8> msk = lit.msk; // copy
|
||||
vector<u8> cmp = lit.cmp; // copy
|
||||
bool noruns = isNoRunsLiteral(build, id, info, max_len);
|
||||
|
||||
bool noruns = isNoRunsFragment(build, f, max_len);
|
||||
DEBUG_PRINTF("fragment is %s\n", noruns ? "noruns" : "not noruns");
|
||||
|
||||
auto lit_final = lit.s; // copy
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user