-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Stack 8001 v11 #14669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack 8001 v11 #14669
Conversation
Even if current caller does not provide too big data. Ticket: 8001
To be able to load 1M signatures and not have a stack overflow Ticket: 8001
To avoid stack overflow A single signature should not have more than 65k buffers Ticket: 8001
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14669 +/- ##
==========================================
- Coverage 82.11% 82.11% -0.01%
==========================================
Files 1011 1011
Lines 262812 262840 +28
==========================================
+ Hits 215812 215833 +21
- Misses 47000 47007 +7
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Information: QA ran without warnings. Pipeline = 29235 |
src/detect-engine-analyzer.c
Outdated
| if (root_jb == NULL) { | ||
| return; | ||
| } | ||
| SCJsonBuilder **arrays = SCCalloc(sizeof(SCJsonBuilder *), de_ctx->buffer_type_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't know if it matters in practice, but callocs first arg is the number of elements, the 2nd is the size per element, the reverse of what is here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok will fix
src/detect-engine-mpm.c
Outdated
| memset(engines_idx, 0, sizeof(engines_idx)); | ||
| int types[max_buffer_id]; | ||
| memset(types, 0, sizeof(types)); | ||
| AppProto(*engines)[g_alproto_max] = SCCalloc(max_buffer_id, sizeof(AppProto[g_alproto_max])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scan-build still complains and it hurts my eyes as well. Can we solve this differently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a pointer of type 'AppProto[g_alproto_max]', which is incompatible with sizeof operand type 'AppProto[g_alproto_max]'
This hurts your eye ?
How differently ? By not having a 2-dimensions array ?
buffer_type_id is a u32 Ticket: 8001
75ab49c to
7a117d7
Compare
|
Oops, just pushed here when I thought I was on a new branch, will see CI here then |
|
Next version in #14676 |
Link to ticket: https://redmine.openinfosecfoundation.org/issues/
https://redmine.openinfosecfoundation.org/issues/8001
Describe changes: improve stack allocations
#14659 with scan-build fix
Tricky line is
AppProto(*engines)[g_alproto_max] = SCCalloc(max_buffer_id, sizeof(AppProto[g_alproto_max]));Still todo after : handle other cases of
git grep '\];' src/*.c | grep -v = | grep -v '[0-9]\];' | grep -v '[A-Z]\];' | grep -v return | grep -v g_alproto_max | grep -v '\[\];' | grep -v sizeofafter src/detect-engine.c