-
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 generic uint 4112 v3 #7150
Conversation
as is done for u8 and u32
Ie inequality test for integer Also adds prefilter functions for u16
In case of greater/lesser or equal
Despite what the comment said 1<>2 is not a valid range as it is empty and cannot have any match. Maybe we should even consider 1<>3 an invalid range as it should rather be written as =2
from http2 to a generic file so that it can be reused by dcerpc and others
aka DetectUintModeNe
ie <0 is impossible
Begins to look good 😊 |
Codecov Report
@@ Coverage Diff @@
## master #7150 +/- ##
==========================================
+ Coverage 78.06% 78.14% +0.07%
==========================================
Files 628 628
Lines 185266 184899 -367
==========================================
- Hits 144635 144488 -147
+ Misses 40631 40411 -220
Flags with carried forward coverage won't be shown. Click here to find out more. |
I do not know why |
#[repr(C)] | ||
pub struct DetectUintData<T> { | ||
pub arg1: T, | ||
pub arg2: T, | ||
pub mode: DetectUintMode, | ||
} |
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.
Nice, I didn't know this could work with cbindgen.
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.
I first tried to use some kind of typedef alias like pub type DetectUintDataU32 DetectUintData<u32>
, but making cbindgen export types caused other problems...
pub mode: DetectUintMode, | ||
} | ||
|
||
fn detect_parse_uint_start_equal<T: std::str::FromStr + std::cmp::PartialOrd + num::Bounded>( |
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.
I wonder if a custom trait would clean up these function definitions.. Something like:
pub trait DetectIntType: std::str::FromStr + std::cmp::PartialOrd + num::PrimInt + num::Bounded {}
impl<T> DetectIntType for T where T: std::str::FromStr + std::cmp::PartialOrd + num::PrimInt + num::Bounded {}
then most of these methods can use <T: DetectIntType>
instead of the string of traits.
I think windows is segfaulting because I call C's @jasonish what do you think of it ? |
You have to free memory that came from Rust back in Rust itself. Pass the pointer back and and call Probably the simplest example of this is |
Information: QA ran without warnings. Pipeline 6597 |
Information: QA ran without warnings. Pipeline 6601 |
This test has been flaky before. |
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.
Needs some further work, see inline discussion between Jason and Philippe
Replaced by #7167 |
Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/4112
Describe changes:
DetectUint
structure fordsize
anddcerpc
Still TODO:
Replaces #7121 with remove the C version to use only rust version