Skip to content

fix: Integer Overflow or Wraparound on Multiplication result converted to larger type #364

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

odaysec
Copy link

@odaysec odaysec commented Feb 28, 2025

Ticket 🎟️ #363

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 size_t before performing the multiplication. This way, the multiplication will be done using the size_t type, which is typically larger than unsigned int and can hold larger values.

The specific change involves modifying the multiplication expression on line 21 to cast m_nAllocationCount to size_t before multiplying it by m_unSizeOfElements.

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.

2 participants