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

Warnint util 4516 v12.2 #7490

Closed
wants to merge 6 commits into from

Conversation

catenacyber
Copy link
Contributor

Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/4516

Describe changes:

  • Fix integer warnings -Wimplicit-int-conversion for detect*
  • Adds ci check for this warning

Follows #7470 with code review taken into account

@catenacyber catenacyber requested review from victorjulien and a team as code owners June 6, 2022 16:22
@codecov
Copy link

codecov bot commented Jun 6, 2022

Codecov Report

Merging #7490 (ee51d2d) into master (51c7868) will increase coverage by 0.03%.
The diff coverage is 81.97%.

@@            Coverage Diff             @@
##           master    #7490      +/-   ##
==========================================
+ Coverage   75.71%   75.74%   +0.03%     
==========================================
  Files         655      655              
  Lines      188391   188401      +10     
==========================================
+ Hits       142635   142706      +71     
+ Misses      45756    45695      -61     
Flag Coverage Δ
fuzzcorpus 60.08% <76.85%> (+0.03%) ⬆️
suricata-verify 52.22% <76.69%> (+0.03%) ⬆️
unittests 60.89% <74.86%> (+<0.01%) ⬆️

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

@suricata-qa
Copy link

WARNING:

field test baseline %
build_asan

Pipeline 7708

@victorjulien
Copy link
Member

Looks like we need a lua builder

detect-lua.c:129:65: error: incompatible function pointer types passing 'int (DetectEngineCtx *, DetectEngineThreadCtx *, const struct DetectEngineAppInspectionEngine_ *, const Signature *, Flow *, uint8_t, void *, void *, uint64_t)' (aka 'int (struct DetectEngineCtx_ *, struct DetectEngineThreadCtx_ *, const struct DetectEngineAppInspectionEngine_ *, const struct Signature_ *, struct Flow_ *, unsigned char, void *, void *, unsigned long)') to parameter of type 'InspectEngineFuncPtr2' (aka 'unsigned char (*)(struct DetectEngineCtx_ *, struct DetectEngineThreadCtx_ *, const struct DetectEngineAppInspectionEngine_ *, const struct Signature_ *, struct Flow_ *, unsigned char, void *, void *, unsigned long)') [-Werror,-Wincompatible-function-pointer-types]
            "smtp_generic", ALPROTO_SMTP, SIG_FLAG_TOSERVER, 0, InspectSmtpGeneric, NULL);
                                                                ^~~~~~~~~~~~~~~~~~
./detect-engine.h:161:31: note: passing argument to parameter 'Callback2' here
        InspectEngineFuncPtr2 Callback2,
                              ^
detect-lua.c:131:65: error: incompatible function pointer types passing 'int (DetectEngineCtx *, DetectEngineThreadCtx *, const struct DetectEngineAppInspectionEngine_ *, const Signature *, Flow *, uint8_t, void *, void *, uint64_t)' (aka 'int (struct DetectEngineCtx_ *, struct DetectEngineThreadCtx_ *, const struct DetectEngineAppInspectionEngine_ *, const struct Signature_ *, struct Flow_ *, unsigned char, void *, void *, unsigned long)') to parameter of type 'InspectEngineFuncPtr2' (aka 'unsigned char (*)(struct DetectEngineCtx_ *, struct DetectEngineThreadCtx_ *, const struct DetectEngineAppInspectionEngine_ *, const struct Signature_ *, struct Flow_ *, unsigned char, void *, void *, unsigned long)') [-Werror,-Wincompatible-function-pointer-types]
            "smtp_generic", ALPROTO_SMTP, SIG_FLAG_TOCLIENT, 0, InspectSmtpGeneric, NULL);
                                                                ^~~~~~~~~~~~~~~~~~
./detect-engine.h:161:31: note: passing argument to parameter 'Callback2' here
        InspectEngineFuncPtr2 Callback2,
                              ^

Fixing this up

@victorjulien victorjulien mentioned this pull request Jun 7, 2022
@catenacyber
Copy link
Contributor Author

This should require also

diff --git a/src/defrag.c b/src/defrag.c
index f2c98dc17..fea66e78c 100644
--- a/src/defrag.c
+++ b/src/defrag.c
@@ -839,8 +839,7 @@ DefragInsertFrag(ThreadVars *tv, DecodeThreadVars *dtv, DefragTracker *tracker,
         goto done;
     }
     memcpy(new->pkt, GET_PKT_DATA(p) + ltrim, GET_PKT_LEN(p) - ltrim);
-    DEBUG_VALIDATE_BUG_ON(GET_PKT_LEN(p) - ltrim > UINT16_MAX);
-    new->len = (uint16_t)(GET_PKT_LEN(p) - ltrim);
+    new->len = (GET_PKT_LEN(p) - ltrim);
     /* in case of unfragmentable exthdrs, update the 'next hdr' field
      * in the raw buffer so the reassembled packet will point to the
      * correct next header after stripping the frag header */
      *

(debug assertion triggered by oss-fuzz)

Should I make a new version of the PR with your change and this one ?

@catenacyber
Copy link
Contributor Author

Looks like we need a lua builder

alma-8 has lua, but integer warnings are not checked on this one

@catenacyber
Copy link
Contributor Author

Replaced by #7507

@catenacyber catenacyber closed this Jun 8, 2022
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