-
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
Warnint util 4516 v5 #7006
Warnint util 4516 v5 #7006
Conversation
Converted to draft due to "fixup" commit. |
Ticket: 4516
Ticket: 4516
Ticket: 4516
Ticket: 4516
Ticket: 4516
Ticket: 4516
Ticket: 4516
Ticket: 4516
Ticket: 4516
Ticket: 4516
Ticket: 4516
Ticket: 4516
8264474
to
08eb259
Compare
Ah I had indeed forgotten to fix it up in its real commit |
@@ -286,7 +286,9 @@ int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, | |||
e->PrefilterTx = PrefilterTxFunc; | |||
e->pectx = pectx; | |||
e->alproto = alproto; | |||
e->tx_min_progress = tx_min_progress; | |||
// TODO change function prototype ? |
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.
That would be good, but lets do that separately. So ticket?
@@ -449,17 +448,15 @@ static void | |||
PrefilterPacketFlowSet(PrefilterPacketHeaderValue *v, void *smctx) | |||
{ | |||
const DetectFlowData *fb = smctx; | |||
v->u8[0] = fb->flags; | |||
v->u8[1] = fb->match_cnt; | |||
v->u16[0] = fb->flags; |
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.
this seems like a real bug that would need a ticket and backports
@@ -156,8 +156,7 @@ static DetectIsdataatData *DetectIsdataatParse (DetectEngineCtx *de_ctx, const c | |||
if (*offset == NULL) | |||
goto error; | |||
} else { | |||
if (StringParseUint16(&idad->dataat, 10, | |||
strlen(args[0]), args[0]) < 0 ) { | |||
if (StringParseUint16(&idad->dataat, 10, (uint16_t)strlen(args[0]), args[0]) < 0) { |
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.
can we avoid these casts somehow? The uint16_t
seems a bit arbitrary, the max accepted value is 23 so turning it into uint8_t
might make sense but then again I think size_t
might make even more sense to we can just pass strlen()
directly into it.
@@ -86,7 +86,9 @@ static bool BufferUrlDecode(const uint8_t *input, const uint32_t input_len, uint | |||
if (i + 2 < input_len) { | |||
if ((isxdigit(input[i+1])) && (isxdigit(input[i+2]))) { | |||
// Decode %HH encoding. | |||
*oi = (input[i+1] >= 'A' ? ((input[i+1] & 0xdf) - 'A') + 10 : (input[i+1] - '0')) << 4; | |||
*oi = (uint8_t)((input[i + 1] >= 'A' ? ((input[i + 1] & 0xdf) - 'A') + 10 |
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.
wow clang-format... really? Can't say this improves things. Might even opt for a clang-format exception here
@@ -580,7 +580,7 @@ int FlowGetPacketDirection(const Flow *, const Packet *); | |||
|
|||
void FlowCleanupAppLayer(Flow *); | |||
|
|||
void FlowUpdateState(Flow *f, enum FlowState s); | |||
void FlowUpdateState(Flow *f, const FlowStateType s); |
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.
the FlowStateType
is the more compact version, but in function args I prefer a real enum to the compiler can check cases and such. Can we keep that here?
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.
What do you expect from the compiler ?
With current code (ie enum FlowState s
)
FlowUpdateState(p->flow, 123456);
gets no warning on my setup
(And I do not get more warnings with this change, like clang is ok to pass 123456 to an uint16_t )
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.
Tried something here #7120
@@ -686,7 +686,11 @@ static uint8_t * GetFullValue(DataValue *dv, uint32_t *len) | |||
static inline uint8_t * FindBuffer(const uint8_t *src, uint32_t len, const uint8_t *find, uint32_t find_len) | |||
{ | |||
/* Use utility search function */ | |||
return BasicSearchNocase(src, len, find, find_len); | |||
if (find_len > UINT16_MAX) { | |||
// TODO rewrite all this to have app-layer events |
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.
ticket
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.
Thanks for pointing this
I did #7074
I managed to get rid of this check at this level (like find_len
is always small enough) so I do not think we need a ticket for this
ERROR: ERROR: QA failed on build_asan. Pipeline 6404 |
Status : splitting this in multiple PRs
Waiting to rebase on what gets merged |
Finally replaced by #7470 |
Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/4516
Describe changes:
-Wimplicit-int-conversion
in all filesExtends #6792 : complete with CI check...
Replaces #6820 with CIFuzz fix for defrag
Thoughts about the commit history ?
This PR can be split into smaller PRs as some points need a careful review (detect-content.c for instance)