-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
detect/transforms: write directly in inspect buffer (backport7) #12100
base: main-7.0.x
Are you sure you want to change the base?
detect/transforms: write directly in inspect buffer (backport7) #12100
Conversation
instead of writing to a temporary buffer and then copying, to save the cost of copying. Ticket: 7229 Not a cherry-pick as we do not put the transforms in rust, but just do this optimization in C
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main-7.0.x #12100 +/- ##
==============================================
- Coverage 83.42% 83.26% -0.16%
==============================================
Files 922 922
Lines 260795 260822 +27
==============================================
- Hits 217558 217168 -390
- Misses 43237 43654 +417
Flags with carried forward coverage won't be shown. Click here to find out more. |
Information: QA ran without warnings. Pipeline 23290 |
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.
some comments inline
@@ -1654,10 +1654,10 @@ void InspectionBufferFree(InspectionBuffer *buffer) | |||
* \brief make sure that the buffer has at least 'min_size' bytes | |||
* Expand the buffer if necessary | |||
*/ |
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.
should add explanation of return value
return buffer->buf; | ||
} | ||
|
||
void InspectionBufferTruncate(InspectionBuffer *buffer, uint32_t buf_len) |
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.
please add a doc
@@ -111,7 +111,11 @@ static void TransformCompressWhitespace(InspectionBuffer *buffer, void *options) | |||
return; | |||
} | |||
|
|||
uint8_t output[input_len]; // we can only shrink | |||
// we can only shrink | |||
uint8_t *output = (uint8_t *)InspectionBufferCheckAndExpand(buffer, input_len); |
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.
why do we need the cast, instead of updating InspectionBufferCheckAndExpand
to return uint8_t *
?
Link to ticket: https://redmine.openinfosecfoundation.org/issues/
https://redmine.openinfosecfoundation.org/issues/7306
Describe changes:
No cherry-pick, but reusing logic in C instead of rust ;-)