]> OCCT Git - occt-copy.git/commit
0030550: Coding - Integer overflow in Standard_CString HashCodes IR-2019-04-12
authortiv <tiv@opencascade.com>
Thu, 11 Apr 2019 07:56:04 +0000 (10:56 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 12 Apr 2019 15:52:49 +0000 (18:52 +0300)
commit5be49cb3054f91ac4ca9f5d2d55b8c3ad0a8e11b
treee5cad4d10ff7d14a1083972759729db10c785fc3
parentf9b30c0db34c00de8b7a3d0724f3b46e23dfd590
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.
87 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/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_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