Skip to content

Comments

util: fix -Wshorten-64-to-32 warnings#12481

Closed
catenacyber wants to merge 1 commit intoOISF:masterfrom
catenacyber:warnint-64to32-6186-v19
Closed

util: fix -Wshorten-64-to-32 warnings#12481
catenacyber wants to merge 1 commit intoOISF:masterfrom
catenacyber:warnint-64to32-6186-v19

Conversation

@catenacyber
Copy link
Contributor

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

Describe changes:

  • fix -Wshorten-64-to-32 warnings for some files : util

Some commits of #9840
#11952 next batch

Still to do afterwards :

  • detect
  • CI check

@codecov
Copy link

codecov bot commented Jan 26, 2025

Codecov Report

Attention: Patch coverage is 69.67213% with 37 lines in your changes missing coverage. Please review.

Project coverage is 80.54%. Comparing base (d63ad75) to head (3dffc34).
Report is 44 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12481      +/-   ##
==========================================
+ Coverage   80.52%   80.54%   +0.01%     
==========================================
  Files         923      923              
  Lines      259176   259204      +28     
==========================================
+ Hits       208708   208778      +70     
+ Misses      50468    50426      -42     
Flag Coverage Δ
fuzzcorpus 56.15% <47.54%> (+0.09%) ⬆️
livemode 19.38% <20.49%> (-0.04%) ⬇️
pcap 44.19% <45.08%> (+<0.01%) ⬆️
suricata-verify 63.30% <49.18%> (-0.03%) ⬇️
unittests 58.45% <42.62%> (-0.01%) ⬇️

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

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 24364

size_t count = 0;
int count = 0;
SCFmem *mem = handler;
size_t available = mem->size - mem->pos;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is checked that his result fits an int?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while (count < size) where size is an int from the function prototype

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks very hacky. size_t actually does look like the correct type here, and the change should probably that the function arg size is also made size_t

@catenacyber catenacyber marked this pull request as draft January 30, 2025 14:52
@catenacyber
Copy link
Contributor Author

Setting as draft as I cannot set changes requested to myself

Copy link
Member

@victorjulien victorjulien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@catenacyber fixed

@catenacyber
Copy link
Contributor Author

Next in #12534

@catenacyber catenacyber closed this Feb 6, 2025
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