Skip to content

Conversation

@michaelbeale-IL
Copy link

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

To fix the problem, force the multiplication to occur in the larger type (size_t) rather than uint32_t. This is done by casting at least one operand of the multiplication (alpha or part) to size_t before the arithmetic operation. Specifically, replace sizePartQl = sizeQl - alpha * part; with sizePartQl = sizeQl - static_cast<size_t>(alpha) * part;. This change ensures that the multiplication is done with 64-bit arithmetic, preventing overflow so long as the result fits in size_t, and matches the intention of the code. Only line 355 needs to change; no new imports/definitions are required.

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