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

Fix code scanning alert no. 686: Multiplication result converted to larger type #28

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

linxie47
Copy link
Contributor

Fixes https://github.com/OpenVisualCloud/iVSR/security/code-scanning/686

To fix the problem, we need to ensure that the multiplication is performed using the larger type (size_t) to avoid overflow. This can be achieved by casting one of the operands to size_t before performing the multiplication. This way, the multiplication will be done using the larger type, and the risk of overflow will be mitigated.

We will modify the code on line 104 to cast the first operand (iB) to size_t before performing the multiplication.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…arger type

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@linxie47 linxie47 marked this pull request as ready for review December 17, 2024 12:19
Copy link
Contributor

@djie1 djie1 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@xiaoxial xiaoxial left a comment

Choose a reason for hiding this comment

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

LGTM

@linxie47 linxie47 merged commit 1f6da3b into master Dec 18, 2024
6 checks passed
@linxie47 linxie47 deleted the alert-autofix-686 branch December 18, 2024 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants