DiscussionsIssue archiveOCCT:Foundation Classes

Archived issue #0030551

Foundation Classes - Integer overflow in NCollection_CellFilter HashCode

CommunityOCCT:Foundation Classesclosed2 public notes

Search issues

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.

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.

01Commenter 1
This issue was fixed as a part of changes made within #0030550: Coding - Integer overflow in Standard_CString HashCodes.

02Commenter 1
Fixed in framework of 30550

Related records