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

Make initial shape accumulate value type explicit #83

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

Conversation

tvincent056
Copy link

On many compilers (tested on gcc 9.2) the std::accumulate function will use the type of the initial value as the accumulated value type. The previous version of the code passed a literal '1' which defaults to an 'int' type. This makes the code vulnerable to type overflows for arrays with many elements. Explicitly casting to size_t should fix this.

@skaiware
Copy link

skaiware commented Mar 7, 2022

@rogersce are you still reviewing PRs ?

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