Eric Leblond
1f07d1521e
Fix realloc error handling
...
This patch is fixing realloc error handling. In case of a realloc
failure, it free the initial memory and continue existing error
handling.
The patch has been obtained via the following semantic patch and
a bit oh hand editing:
@@
expression x, E;
identifier f;
@@
f(...)
{
+ void *ptmp;
<+...
- x = SCRealloc(x, E);
+ ptmp = SCRealloc(x, E);
... when != x
- if (x == NULL)
+ if (ptmp == NULL)
{
+ SCFree(x);
+ x = NULL;
...
- }
+ } else {
+ x = ptmp;
+ }
...+>
}
@@
expression x, E;
identifier f;
statement ES;
@@
f(...) {
+ void *ptmp;
<+...
- x = SCRealloc(x, E);
+ ptmp = SCRealloc(x, E);
... when != x
- if (x == NULL) ES
+ if (ptmp == NULL) {
+ SCFree(x);
+ x = NULL;
+ ES
+ } else {
+ x = ptmp;
+ }
...+>
}
@@
expression x, E;
identifier f;
@@
f(...)
{
+ void *ptmp;
<+...
- x = SCRealloc(x, E);
+ ptmp = SCRealloc(x, E);
... when != x
- if (unlikely(x == NULL))
+ if (unlikely(ptmp == NULL))
{
+ SCFree(x);
+ x = NULL;
...
- }
+ } else {
+ x = ptmp;
+ }
...+>
}
@@
expression x, E;
identifier f;
statement ES;
@@
f(...) {
+ void *ptmp;
<+...
- x = SCRealloc(x, E);
+ ptmp = SCRealloc(x, E);
... when != x
- if (unlikely(x == NULL)) ES
+ if (unlikely(ptmp == NULL)) {
+ SCFree(x);
+ x = NULL;
+ ES
+ } else {
+ x = ptmp;
+ }
...+>
}
13 years ago
Anoop Saldanha
a49cbf8a49
Code cleanup.
...
Use the MpmAddPattern[CS|CI] wrapper to add patterns to the mpm context.
Also use MpmInitCtx() to init the mpm context.
13 years ago
Anoop Saldanha
cfa2cda42b
fix for bug #973 .
...
An alternative solution for bug #970 .
For chopped patterns, which in it's whole is a duplicate of another
pattern we assign an unique content id.
13 years ago
Anoop Saldanha
8c1e855632
fix for bug #970(ac-gfbs).
...
Content strings that are a duplicate of a pattern from another sig, but
have a fast_pattern chop being applied, would end up being assigned the
same pattern id as the duplicate string. But the string supplied to the
mpm would be the chopped string, which might result in the state_table
output_state content entry being over-riden by the the fuller string at
the final state of the smaller content length, because of which during a
match we might end up inspecting the search buffer against the fuller
content pattern, instead of the chopped pattern, which would end up being
an inspection beyond the buffer bounds.
13 years ago
Anoop Saldanha
92a8b2b738
Unittest to display bug #970(ac-gfbs).
13 years ago
Anoop Saldanha
3c2ddf04c1
Update mpm init ctx to not accept the final cuda_rc_module argument.
...
It was a part of our older architecture and is no longer used.
14 years ago
Eric Leblond
e176be6fcc
Use unlikely for error treatment.
...
When handling error case on SCMallog, SCCalloc or SCStrdup
we are in an unlikely case. This patch adds the unlikely()
expression to indicate this to gcc.
This patch has been obtained via coccinelle. The transformation
is the following:
@istested@
identifier x;
statement S1;
identifier func =~ "(SCMalloc|SCStrdup|SCCalloc)";
@@
x = func(...)
... when != x
- if (x == NULL) S1
+ if (unlikely(x == NULL)) S1
14 years ago
Anoop Saldanha
b0b29fb85a
ac-bs and ac-gfbs mem cleanup
15 years ago
Victor Julien
0788656ef7
Silence ac-gfbs debug message.
15 years ago
Eileen Donlon
0bb4ff34b8
added null checks for init_hash to all ac mpms
15 years ago
Anoop Saldanha
419cdc8558
support splitting mpm ctxs based on direction v2
15 years ago
Victor Julien
146ff9d66e
Suppress ac-gfbs debug message being printed at info level.
15 years ago
Anoop Saldanha
6e2c921037
indentation fixes for ac-gfbs
15 years ago
Anoop Saldanha
2eb3aff0af
Further improve compression for ac-gfbs. Character codes shifted to 8 bits from 16/32 bits
15 years ago
Anoop Saldanha
5620844f7d
ac-gfbs fix output presence combination with mod table
15 years ago
Anoop Saldanha
153f2ad3eb
ac-gfbs update. Minor improvement of compression for state 0. Improves performance
15 years ago
Anoop Saldanha
c6cd59bda4
Update ac-gfbs with some rearrangement. Increased performance from 4-10%
15 years ago
Anoop Saldanha
420befb180
Changed my email address to anoopsaldanha at gmail dot com from my current one
15 years ago
Anoop Saldanha
99baf18c8d
updates to ac-gfbs search. Remove unnecessary casting of pointers
15 years ago
Anoop Saldanha
11e7dda59a
updates to ac-gfbs search. Introduce handling cases where state_count is < 32k
15 years ago
Anoop Saldanha
708c4ad055
updates to ac-gfbs search. Combine output presence with mod goto table
15 years ago
Anoop Saldanha
a4ea7e6197
updates to ac-gfbs search. Combine failure table along with mod goto table for better cache perf
15 years ago
Anoop Saldanha
b69ac9514f
updates to ac-gfbs search. Disable handling < 65k states separately. Now any state count would be given same treatment
15 years ago
Anoop Saldanha
efb4c27b1f
updates to ac-gfbs search. Add new unittests + fix cases where we have 2 patterns that are same but one is CS and other CI + Use SCMemcmp for state < 65k instead of custom memcmp
15 years ago
Anoop Saldanha
0920296aaa
updates to ac-gfbs search. Remove unnecessary casting of pointers
15 years ago
Anoop Saldanha
d149a5e806
updates to ac-gfbs search. Use SCMemcmp instead of the custom pattern searching used
15 years ago
Anoop Saldanha
47f2d6e07b
updates to ac-gfbs search. Optimize pointer de-referencing for pid_pat_list
15 years ago
Anoop Saldanha
991f6d2d83
updates to ac-gfbs search. Optimize pointer de-referencing for frequently used pointers
15 years ago
Anoop Saldanha
ffb925e3b3
indentation fixes for ac-gfbs
15 years ago
Anoop Saldanha
e9eb0e502c
updates to ac-gfbs search. Handle cases where we have a single entry for a state goto transition, just like how we handle for no entry for a particular state
15 years ago
Anoop Saldanha
63ed36a892
Replace all reallocs with SCReallocs
15 years ago
Anoop Saldanha
4307ea2348
Replace all frees with SCFrees
15 years ago
Anoop Saldanha
13ea299ee0
Replace all mallocs with SCMallocs
15 years ago
pilcrow
ed69eeab14
Safer macro parenthesization and do/while use
15 years ago
Eric Leblond
49adc264bc
Don't print message after SCMalloc failure.
...
This patch generated via coccinelle is getting rid of logging
message after a SCMalloc failure. They were useless as SCMalloc
already displays a message.
16 years ago
Anoop Saldanha
5cc7f90f45
fix hash bug in ac-gfbs. Should reduce the no of patterns added for single context ac-gfbs from a million to a couple of thousands. Also support no case handling. \todo support insertion of final state presence into goto_table and failure table state transitions
16 years ago
Anoop Saldanha
4b2cf7e125
fix ac, ac-gfbs to support new changes to util-mpm.h + remove some junk code
16 years ago
Anoop Saldanha
b9a770740a
add comments and todos for ac and ac-gfbs
16 years ago
Anoop Saldanha
658ff5753d
aho-corasick for the cpu. We have 2 versions of ac. The first MPM_AC uses the delta table and the secone one MPM_AC_GFBS uses the goto-failure table
16 years ago