Skip to content

Conversation

michaelbeale-IL
Copy link

Potential fix for https://github.com/IntelLabs/HEC-openfhe-development-test/security/code-scanning/40

To fix the issue, ensure that the multiplication uses the larger type (size_t) before performing the computation, not only after. This is done by explicitly casting one (or both) of the operands to size_t before multiplying. Change all instances of s * layersCollapse in the relevant region so their multiplication is performed in size_t arithmetic, ensuring the multiplication cannot overflow a 32-bit integer even if either operand is large. Only the usages shown on lines 698, 699, 700, 712, 715, 718 need review, but CodeQL only flagged line 698; other usages can be safely left, but it would be good practice to fix similar expressions in the region as well.

No additional includes, methods, or variable definitions are required, as size_t and explicit casting are standard in C++.

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

…onverted to larger type

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
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