mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
hscollider: fix UTF8 check for patterns
This commit is contained in:
parent
7c4490cfc9
commit
934473f406
@ -241,6 +241,13 @@ void addCallout(string &re) {
|
||||
re.append("\\E)(?C)");
|
||||
}
|
||||
|
||||
static
|
||||
bool isUtf8(const CompiledPcre &compiled) {
|
||||
unsigned long int options = 0;
|
||||
pcre_fullinfo(compiled.bytecode, NULL, PCRE_INFO_OPTIONS, &options);
|
||||
return options & PCRE_UTF8;
|
||||
}
|
||||
|
||||
unique_ptr<CompiledPcre>
|
||||
GroundTruth::compile(unsigned id, bool no_callouts) {
|
||||
bool highlander = false;
|
||||
@ -380,6 +387,8 @@ GroundTruth::compile(unsigned id, bool no_callouts) {
|
||||
throw PcreCompileFailure(oss.str());
|
||||
}
|
||||
|
||||
compiled->utf8 |= isUtf8(*compiled);
|
||||
|
||||
return compiled;
|
||||
}
|
||||
|
||||
@ -451,13 +460,6 @@ int scanBasic(const CompiledPcre &compiled, const string &buffer,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static
|
||||
bool isUtf8(const CompiledPcre &compiled) {
|
||||
unsigned long int options = 0;
|
||||
pcre_fullinfo(compiled.bytecode, NULL, PCRE_INFO_OPTIONS, &options);
|
||||
return options & PCRE_UTF8;
|
||||
}
|
||||
|
||||
static
|
||||
CaptureVec makeCaptureVec(const vector<int> &ovector, int ret) {
|
||||
assert(ret > 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user