View Issue Details

IDProjectCategoryView StatusLast Update
0001286FreeCADBugpublic2014-09-17 09:51
Reportershoogen Assigned Toshoogen  
PrioritynormalSeveritycrashReproducibilitysometimes
Status closedResolutionfixed 
Product Version0.13 
Summary0001286: OCCT Exceptions without a Message causes SIGSEGV
DescriptionOCCT allows Standard_Failure not to have a Message.
Querying for the message return a NULL pointer.
Calling PyErr_SetString(PyExc_Exception, 0);
causes a null pointer dereference (in the glibc in linux_x86_64)

PyErr_SetString(PyExc_Exception, e->GetMessageString());
Additional Informationpossible fix check for NULL pointer.
Standard_CString msg = e->GetMessageString();
PyErr_SetString(PyExc_Exception, msg ? msg : 'Standard_Failure without message' );
TagsNo tags attached.
FreeCAD Information

Relationships

related to 0001422 closedwmayer Subclass Exception 
related to 0001700 closedshoogen do not raise (pythons) base Exception 

Activities

shoogen

2013-10-24 06:55

developer   ~0003794

OS: Debian GNU/Linux 7.2 (wheezy)
Platform: 64-bit
Version: 0.14.2667 (Git)
Branch: dev-0000895-BSpline
Hash: 35633a606c2f35b231f09e6250508aa32458f2b0
Python version: 2.7.3
Qt version: 4.8.2
Coin version: 3.1.3
SoQt version: 1.5.0
OCC version: 6.5.0

shoogen

2013-10-24 08:23

developer   ~0003796

Better solution (used in Part::BSplineCurvePy::makeC1Continuous)

catch (Standard_Failure) {
        Handle_Standard_Failure e = Standard_Failure::Caught();
        std::string err = e->GetMessageString();
        if (err.empty()) err = e->DynamicType()->Name();
        PyErr_SetString(PyExc_Exception, err.c_str());
        return 0;
}

wmayer

2013-10-24 12:26

administrator   ~0003798

> std::string err = e->GetMessageString();
In case the method returns a null pointer then the assignment to std::string also gives a SIGSEGV!

shoogen

2014-08-20 15:09

developer   ~0004980

The new PY_CATCH_OCC macro will check for a NULL message.

Issue History

Date Modified Username Field Change
2013-10-24 06:52 shoogen New Issue
2013-10-24 06:55 shoogen Note Added: 0003794
2013-10-24 08:23 shoogen Note Added: 0003796
2013-10-24 12:26 wmayer Note Added: 0003798
2014-08-19 14:13 shoogen Relationship added related to 0001422
2014-08-19 14:13 shoogen Relationship added related to 0001700
2014-08-20 15:09 shoogen Note Added: 0004980
2014-09-17 09:51 shoogen Status new => closed
2014-09-17 09:51 shoogen Assigned To => shoogen
2014-09-17 09:51 shoogen Resolution open => fixed