test/subslice: Add test cases for subslice#2749
Open
jlucovsky wants to merge 1 commit intoOISF:masterfrom
Open
test/subslice: Add test cases for subslice#2749jlucovsky wants to merge 1 commit intoOISF:masterfrom
jlucovsky wants to merge 1 commit intoOISF:masterfrom
Conversation
This was referenced Dec 6, 2025
catenacyber
reviewed
Dec 11, 2025
This was referenced Jan 13, 2026
catenacyber
reviewed
Jan 29, 2026
| # startswith, endswith, bsize | ||
| alert http any any -> any any (http.user_agent; content: "curl/7.64.1"; subslice: -10,3; content: "url"; startswith; endswith; bsize:3; sid:3;) | ||
| alert http any any -> any any (http.response_body; subslice: 28,14; content: "EICAR-STANDARD"; bsize: 14;startswith; endswith; sid:4;) | ||
| alert http any any -> any any (http.user_agent; content: "curl/7.64.1";subslice: -10,3; content: "url"; bsize: 3; startswith; endswith; sid:5; |
Collaborator
There was a problem hiding this comment.
What is the diff between sid 3 and 5 ?
Contributor
Author
There was a problem hiding this comment.
Good catch; will remove duplicate.
catenacyber
reviewed
Jan 29, 2026
catenacyber
reviewed
Jan 29, 2026
| # empty buffer test: bsize:0 -- offset is past buffer length | ||
| alert http any any -> any any (http.accept; content: "*/*";subslice: 9, 2; bsize:0; sid:7;) | ||
|
|
||
| # offset + nbytes exceeds length, not truncating so buffer will be empty |
Collaborator
There was a problem hiding this comment.
We do not have tests with negative value for nbytes as documented
Issue: 7672 Applies to versions 9+ Add test cases for the subslice transform, including some edge cases. Test cases cover all use cases, including cases where truncate has impact.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue: 7672
Add test cases for the subslice transform
Ticket
If your pull request is related to a Suricata ticket, please provide
the full URL to the ticket here so this pull request can monitor
changes to the ticket status:
Redmine ticket: 7672