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
Warn integers downcast 64to32 6186 v1 #9105
Conversation
@@ -686,7 +686,7 @@ static uint32_t AppLayerProtoDetectProbingParserGetMask(AppProto alproto) | |||
FatalError("Unknown protocol detected - %u", alproto); | |||
} | |||
|
|||
SCReturnUInt(1UL << (uint32_t)alproto); | |||
SCReturnUInt(1 << (uint32_t)alproto); |
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 AppLayerProtoDetectProbingParserGetMask
return a u64 ?
But then flow structure needs to grow 2 u32 into 2 u64...
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 an u64
?
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.
Because we will soon have more than 32 app-layer protocols, right ?
@@ -60,7 +60,7 @@ typedef struct Frame { | |||
typedef struct Frames { | |||
uint16_t cnt; | |||
uint16_t dyn_size; /**< size in elements of `dframes` */ | |||
uint32_t left_edge_rel; | |||
uint64_t left_edge_rel; |
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.
@victorjulien is this correct for frames ?
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.
no it's u32 intentionally, it's relative to something, I think the stream base seq. So when used it's added to that other thing.
@@ -53,8 +53,8 @@ typedef struct { | |||
{ \ | |||
.secs = 0, .usecs = 0 \ | |||
} | |||
#define SCTIME_USECS(t) ((uint64_t)(t).usecs) | |||
#define SCTIME_SECS(t) ((uint64_t)(t).secs) |
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.
@jlucovsky do you remember the reason for the cast ?
Also draft to get CI feedback. |
WARNING:
Pipeline 14912 |
Replaced by #9117 |
Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/6186
Describe changes:
-Wshorten-64-to-32
flag to clang after-Wimplicit-int-conversion
Provide values to any of the below to override the defaults.
OISF/libhtp#396
Draft : is this the way to go ?
Make multiple PRs for this redmine ticket
I will remove the CI commit in the next version, but so, we have some red feedback to see what is still to be fixed