Skip to content
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

Conversation

catenacyber
Copy link
Contributor

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 ;-)

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
Copy link

codecov bot commented Nov 7, 2024

Codecov Report

Attention: Patch coverage is 78.26087% with 10 lines in your changes missing coverage. Please review.

Project coverage is 83.26%. Comparing base (3000e96) to head (25d5c1e).
Report is 7 commits behind head on main-7.0.x.

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     
Flag Coverage Δ
fuzzcorpus 64.35% <52.17%> (-0.43%) ⬇️
suricata-verify 63.31% <78.26%> (-0.03%) ⬇️
unittests 62.38% <45.65%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 23290

Copy link
Member

@victorjulien victorjulien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some comments inline

src/detect-engine.c Show resolved Hide resolved
src/detect-engine.c Show resolved Hide resolved
@@ -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);
Copy link
Member

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 *?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@catenacyber
Copy link
Contributor Author

Next in #12125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants