← Back to team overview

kicad-developers team mailing list archive

PATCH: segfault in VRML2 plugin

 

The attached patch fixes a segfault in the VRML2 plugin
which is caused by Shape entities with empty vertex
lists.

- Cirilo
=== modified file 'plugins/3d/vrml/v2/vrml2_shape.cpp'
--- plugins/3d/vrml/v2/vrml2_shape.cpp	2016-02-23 02:31:51 +0000
+++ plugins/3d/vrml/v2/vrml2_shape.cpp	2016-05-20 00:47:27 +0000
@@ -476,6 +476,15 @@
 
     SGNODE* pShape = shNode.GetRawPtr();
     SGNODE* pGeom = geometry->TranslateToSG( pShape );
+
+    if( NULL == pGeom )
+    {
+        // this can happen if a VRML file contains
+        // empty point or index sets
+        shNode.Destroy();
+        return NULL;
+    }
+
     SGNODE* pApp = NULL;
 
     if( NULL != appearance )


Follow ups