Archived issue #0030551
Foundation Classes - Integer overflow in NCollection_CellFilter HashCode
Description
I compiled OCCT with the -fsanitize=undefined flag and got the following errors:
src/NCollection/NCollection_CellFilter.hxx:328:25: runtime error: left shift of 79114230870873 by 21 places cannot be represented in type 'long int'
src/NCollection/NCollection_CellFilter.hxx:328:25: runtime error: left shift of 79088553295872 by 21 places cannot be represented in type 'long int'
I can provide a specific example string that reproduces this if needed.
A simple fix is to change 'long aCode' to 'Standard_Size aCode', as well as the return value of the HashCode function.
src/NCollection/NCollection_CellFilter.hxx:328:25: runtime error: left shift of 79114230870873 by 21 places cannot be represented in type 'long int'
src/NCollection/NCollection_CellFilter.hxx:328:25: runtime error: left shift of 79088553295872 by 21 places cannot be represented in type 'long int'
I can provide a specific example string that reproduces this if needed.
A simple fix is to change 'long aCode' to 'Standard_Size aCode', as well as the return value of the HashCode function.
Steps to reproduce
Compile OCCT with a g++ newer than 4.9 with the -fsanitize=undefined compiler flag and run the test suite.
Public activity
2 archived notes
Participants are labeled by their role within this record.
This issue was fixed as a part of changes made within #0030550: Coding - Integer overflow in Standard_CString HashCodes.
Fixed in framework of 30550
Related records