Skip to content

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