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. 37: Multiplication result converted to larger type #24

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

cooljeanius
Copy link
Owner

Fixes https://github.com/cooljeanius/emacs/security/code-scanning/37

To fix the problem, we need to ensure that the multiplication is performed using a larger integer type to avoid overflow. This can be achieved by casting one of the operands to long before performing the multiplication. This way, the multiplication will be done in the long type, which has a larger range and can accommodate larger values without overflow.

Specifically, we will cast height to long before the multiplication. This change will be made on line 3172 of the file src/image.c.

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

…rger type

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@cooljeanius cooljeanius marked this pull request as ready for review September 25, 2024 23:35
Copy link
Owner Author

@cooljeanius cooljeanius left a comment

Choose a reason for hiding this comment

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

just a simple cast; ok

@cooljeanius cooljeanius merged commit d945ae6 into master Sep 25, 2024
19 checks passed
@cooljeanius cooljeanius deleted the autofix/alert-37-c1ac964560 branch September 25, 2024 23:36
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.

1 participant