gloo icon indicating copy to clipboard operation
gloo copied to clipboard

Fix possible interger overflow in multiplication

Open EnricoMi opened this issue 3 years ago • 12 comments

There are some integer multiplications that might overflow before cast to a larger type:

Multiplication result may overflow 'int' before it is converted to 'difference_type'.

This rule finds code that converts the result of an integer multiplication to a larger type.
Since the conversion applies after the multiplication, arithmetic overflow may still occur.

Constructor std::vector takes std::size_t as size argument where in these places ints are multiplied. On 64 bit architectures this means that int multiplication could overflow while std::size_t is sufficiently large.

See CWE-190 CWE-192 CWE-197 CWE-681.

EnricoMi avatar Jan 14 '22 13:01 EnricoMi

@pietern what are your thoughts?

EnricoMi avatar Jan 22 '22 09:01 EnricoMi

@EnricoMi I don't work on Gloo anymore. The change looks good to me though :-)

pietern avatar Jan 30 '22 12:01 pietern

@pietern any suggestion who would be best to poke? maybe @sofong5

EnricoMi avatar Jan 30 '22 14:01 EnricoMi

cc @jiayisuse

mrshenli avatar Jan 31 '22 16:01 mrshenli

How can we get this fairly simple fix in? This removes those annoying vulnerability alerts from Gloo?

EnricoMi avatar Mar 03 '22 08:03 EnricoMi

@jiayisuse @mrshenli @pritamdamania @minsii @luciang @mingzhe09088 @meyering any suggestions who to ping for review?

EnricoMi avatar Aug 15 '22 12:08 EnricoMi

I don't have approval permission. Sorry I cannot help. The PR itself looks good to me :-)

minsii avatar Aug 16 '22 21:08 minsii

@pietern @malfet @peterbell10 any suggestion how to get hold of a committer?

EnricoMi avatar Oct 19 '22 08:10 EnricoMi

Hey @EnricoMi, Sorry for keeping you waiting so long, and thank you for submitting your contributions to this repository! I've approved the changes, just need to look into how to complete the merge, I see some tests are failing

rctl avatar Jan 13 '23 18:01 rctl

@rctl thanks for looking into this. I reckon the errors are transient, can you please rerun the CI?

EnricoMi avatar Jan 14 '23 18:01 EnricoMi

@rctl the remaining failing tests still look unrelated.

EnricoMi avatar Feb 24 '23 10:02 EnricoMi

@rctl who can merge this?

EnricoMi avatar Dec 29 '23 13:12 EnricoMi