0030550: Coding - Integer overflow in Standard_CString HashCodes IR-WEEK16-1
authortiv <tiv@opencascade.com>
Thu, 28 Mar 2019 09:42:41 +0000 (12:42 +0300)
committerbugmaster <bugmaster@opencascade.com>
Tue, 16 Apr 2019 17:38:23 +0000 (20:38 +0300)
commit2b2be3fb825f5823d4fa446d7e88facab937beab
tree7b2a6bd3e67328d368876ec2cc6f7a34a6345714
parent833034f301099cfd77abe4d57cba1bfd5659183a
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.
89 files changed:
src/BOPDS/BOPDS_Pair.hxx
src/BOPDS/BOPDS_PairMapHasher.hxx
src/BOPDS/BOPDS_PaveMapHasher.hxx
src/BOPDS/BOPDS_PaveMapHasher.lxx
src/BOPTools/BOPTools_Parallel.hxx
src/BOPTools/BOPTools_Set.cxx
src/BOPTools/BOPTools_Set.hxx
src/BOPTools/BOPTools_SetMapHasher.hxx
src/BOPTools/BOPTools_SetMapHasher.lxx
src/BRepMesh/BRepMesh_Edge.hxx
src/BRepMesh/BRepMesh_OrientedEdge.hxx
src/BRepMesh/BRepMesh_Triangle.hxx
src/BRepMesh/BRepMesh_Vertex.hxx
src/Font/Font_FontMgr.hxx
src/Font/Font_SystemFont.hxx
src/IMeshData/IMeshData_Types.hxx
src/IntPolyh/IntPolyh_Couple.hxx
src/IntPolyh/IntPolyh_CoupleMapHasher.hxx
src/IntTools/IntTools_CurveRangeSampleMapHasher.hxx
src/IntTools/IntTools_CurveRangeSampleMapHasher.lxx
src/IntTools/IntTools_SurfaceRangeSampleMapHasher.hxx
src/IntTools/IntTools_SurfaceRangeSampleMapHasher.lxx
src/Interface/Interface_MapAsciiStringHasher.cxx
src/Interface/Interface_MapAsciiStringHasher.hxx
src/MAT2d/MAT2d_MapBiIntHasher.hxx
src/MAT2d/MAT2d_MapBiIntHasher.lxx
src/MeshVS/MeshVS_SymmetricPairHasher.hxx
src/MeshVS/MeshVS_TwoColors.cxx
src/MeshVS/MeshVS_TwoColors.hxx
src/MeshVS/MeshVS_TwoNodes.hxx
src/MoniTool/MoniTool_ElemHasher.cxx
src/MoniTool/MoniTool_ElemHasher.hxx
src/MoniTool/MoniTool_MTHasher.hxx
src/MoniTool/MoniTool_MTHasher.lxx
src/NCollection/NCollection_AccAllocator.hxx
src/NCollection/NCollection_CellFilter.hxx
src/NCollection/NCollection_DefaultHasher.hxx
src/OSD/OSD_Thread.cxx
src/Poly/Poly_MakeLoops.hxx
src/QANCollection/QANCollection_Test.cxx
src/Quantity/Quantity_ColorHasher.hxx
src/Quantity/Quantity_ColorRGBAHasher.hxx
src/RWStl/RWStl_Reader.cxx
src/STEPConstruct/STEPConstruct_PointHasher.hxx
src/STEPConstruct/STEPConstruct_PointHasher.lxx
src/Standard/FILES
src/Standard/Standard_Address.hxx
src/Standard/Standard_CString.cxx
src/Standard/Standard_CString.hxx
src/Standard/Standard_ErrorHandler.cxx
src/Standard/Standard_ExtString.cxx
src/Standard/Standard_ExtString.hxx
src/Standard/Standard_GUID.cxx
src/Standard/Standard_GUID.hxx
src/Standard/Standard_Handle.hxx
src/Standard/Standard_Integer.hxx
src/Standard/Standard_Real.cxx
src/Standard/Standard_Real.hxx
src/Standard/Standard_ShortReal.cxx
src/Standard/Standard_ShortReal.hxx
src/Standard/Standard_Size.hxx
src/Standard/Standard_Std.hxx [new file with mode: 0644]
src/Standard/Standard_ThreadId.hxx
src/Standard/Standard_Transient.hxx
src/Standard/Standard_Type.cxx
src/StepToTopoDS/StepToTopoDS_CartesianPointHasher.cxx
src/StepToTopoDS/StepToTopoDS_CartesianPointHasher.hxx
src/StepToTopoDS/StepToTopoDS_PointPairHasher.cxx
src/StepToTopoDS/StepToTopoDS_PointPairHasher.hxx
src/TColStd/TColStd_PackedMapOfInteger.cxx
src/TCollection/TCollection_AsciiString.hxx
src/TCollection/TCollection_AsciiString.lxx
src/TCollection/TCollection_ExtendedString.hxx
src/TDF/TDF_LabelMapHasher.hxx
src/TObj/TObj_Common.hxx
src/TopLoc/TopLoc_Location.cxx
src/TopLoc/TopLoc_Location.hxx
src/TopTools/TopTools_OrientedShapeMapHasher.hxx
src/TopTools/TopTools_OrientedShapeMapHasher.lxx
src/TopTools/TopTools_ShapeMapHasher.hxx
src/TopTools/TopTools_ShapeMapHasher.lxx
src/TopoDS/TopoDS_Shape.cxx
src/TopoDS/TopoDS_Shape.hxx
src/Transfer/Transfer_FindHasher.cxx
src/Transfer/Transfer_FindHasher.hxx
src/VrmlData/VrmlData_Node.cxx
src/VrmlData/VrmlData_Node.hxx
src/XCAFDoc/XCAFDoc_AssemblyItemId.hxx
src/XCAFPrs/XCAFPrs_Style.hxx