mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
RE_Match_State: Do not reset current_pos for every Match() call
This seems like a bug: If one feeds one byte at a time, current_pos is being reset for every byte, possibly reporting the wrong offsets in the accepted_matches map.
This commit is contained in:
parent
b0a200a5dc
commit
56830948e3
1 changed files with 4 additions and 2 deletions
|
@ -268,6 +268,7 @@ bool RE_Match_State::Match(const u_char* bv, int n, bool bol, bool eol, bool cle
|
|||
|
||||
// Initialize state and copy the accepting states of the start
|
||||
// state into the acceptance set.
|
||||
current_pos = 0;
|
||||
current_state = dfa->StartState();
|
||||
|
||||
const AcceptingSet* ac = current_state->Accept();
|
||||
|
@ -276,13 +277,14 @@ bool RE_Match_State::Match(const u_char* bv, int n, bool bol, bool eol, bool cle
|
|||
AddMatches(*ac, 0);
|
||||
}
|
||||
|
||||
else if ( clear )
|
||||
else if ( clear ) {
|
||||
current_pos = 0;
|
||||
current_state = dfa->StartState();
|
||||
}
|
||||
|
||||
if ( ! current_state )
|
||||
return false;
|
||||
|
||||
current_pos = 0;
|
||||
|
||||
size_t old_matches = accepted_matches.size();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue