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

output: fix logic error #8530

Conversation

ProjectMutilation
Copy link
Contributor

@ProjectMutilation ProjectMutilation commented Feb 9, 2023

The logical error may have been made here. Comparison with the upper
bound of the variable type does not make sense. It may be worth adding
the cast of one of the multiplication operands to the 64-bit type for
avoiding overflow

Found by Security Code with Svace static analyzer
Bug: #5789

Signed-off-by: Maxim Korotkov m.korotkov@securitycode.ru

Make sure these boxes are signed before submitting your Pull Request -- thank you.

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

Describe changes:

  • Added cast to ULL one of the operands of multiplication for avoiding overflow

#suricata-verify-pr:
#suricata-verify-repo:
#suricata-verify-branch:
#suricata-update-pr:
#suricata-update-repo:
#suricata-update-branch:
#libhtp-pr:
#libhtp-repo:
#libhtp-branch:

 The logical error may have been made here. Comparison with the upper
 bound of the variable type does not make sense. It may be worth adding
 the cast of one of the multiplication operands to the 64-bit type for
 avoiding overflow

Found by Security Code with Svace static analyzer
Bug: OISF#5789

Signed-off-by: Maxim Korotkov <m.korotkov@securitycode.ru>
@ProjectMutilation
Copy link
Contributor Author

@victorjulien hi, can you explain why tests were failing please? I don't have idea

@victorjulien
Copy link
Member

Probably needs a rebase to master. The failing test was merged yesterday following a fix in master.

@codecov
Copy link

codecov bot commented Feb 11, 2023

Codecov Report

Merging #8530 (43014bf) into master (4ad5e04) will decrease coverage by 0.05%.
The diff coverage is 100.00%.

❗ Current head 43014bf differs from pull request most recent head 2ec95f0. Consider uploading reports for the commit 2ec95f0 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8530      +/-   ##
==========================================
- Coverage   81.95%   81.90%   -0.05%     
==========================================
  Files         967      967              
  Lines      278373   278373              
==========================================
- Hits       228129   228001     -128     
- Misses      50244    50372     +128     
Flag Coverage Δ
fuzzcorpus 64.05% <100.00%> (+0.03%) ⬆️
suricata-verify 59.80% <100.00%> (-0.11%) ⬇️
unittests 63.36% <0.00%> (ø)

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

@jufajardini
Copy link
Contributor

Tests pass now :)
Could you please square these commits? That rebase commit isn't something we keep in our commit history, like that.

Copy link
Contributor

@jufajardini jufajardini left a comment

Choose a reason for hiding this comment

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

Please see my inline comment :)

@ProjectMutilation
Copy link
Contributor Author

Please see my inline comment :)

yep, i saw it, I'll do it a little later

@ProjectMutilation
Copy link
Contributor Author

i'll create new pr with clean history :)

@jufajardini
Copy link
Contributor

Followed by: #8547

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants