]> OCCT Git - occt-copy.git/commitdiff
0030712: Application Framework - Protect binary TriangulationDriver against empty... CR0-720-Hybrid
authormsv <msv@opencascade.com>
Wed, 15 May 2019 09:10:36 +0000 (12:10 +0300)
committermsv <msv@opencascade.com>
Wed, 15 May 2019 09:10:36 +0000 (12:10 +0300)
The matter is that when the binary OCAF file contained a triangulation with 0 nodes and 0 triangles the method Paste would cause construction error of Poly_Triangulation.
This patch protects this method against exception.

src/BinMDataXtd/BinMDataXtd_TriangulationDriver.cxx

index fa7e56553911dca1993ccaec805dd7c2c8ae1023..1d335f6ed706793e172570296fba803e6f2895f1 100644 (file)
@@ -63,6 +63,11 @@ Standard_Boolean BinMDataXtd_TriangulationDriver::Paste(const BinObjMgt_Persiste
   theSource >> hasUV;
   theSource >> deflection;
 
+  if (!nbNodes || !nbTriangles)
+  {
+    return Standard_False;
+  }
+
   // allocate the mesh
   Handle(Poly_Triangulation) PT = new Poly_Triangulation(nbNodes, nbTriangles, hasUV);