mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0030550: Coding - Integer overflow in Standard_CString HashCodes
0030551: Foundation Classes - Integer overflow in NCollection_CellFilter HashCode Signed integers are not used in hash code functions now to prevent undefined behavior on left shift operations with signed integers. A possibility of negative values of hash codes is eliminated. INT_MAX → IntegerLast() in hash code functions. All found hash code functions behaves uniformly now: they return a value in the range [1, theUpperBound]. Relevant comments are added to such functions.
This commit is contained in:
@@ -13,15 +13,17 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
//#include <BOPTools_SetMapHasher.ixx>
|
||||
|
||||
//=======================================================================
|
||||
//function : HashCode
|
||||
//purpose :
|
||||
// function : HashCode
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
inline Standard_Integer BOPTools_SetMapHasher::HashCode(const BOPTools_Set& theSS,
|
||||
const Standard_Integer Upper)
|
||||
inline Standard_Integer BOPTools_SetMapHasher::HashCode (const BOPTools_Set& theSet,
|
||||
const Standard_Integer theUpperBound)
|
||||
{
|
||||
return theSS.HashCode(Upper);
|
||||
return theSet.HashCode (theUpperBound);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function :IsEqual
|
||||
//purpose :
|
||||
|
Reference in New Issue
Block a user