Correct a security check in PyHurricane.h.

* Bug: In Hurricane, in PyHurricane.h, the macro GENERIC_METHOD_HEAD was
    not checking at all that the underlying Hurricane object was not NULL.
    This may have lead to core-dumps.
This commit is contained in:
Jean-Paul Chaput 2016-04-13 18:30:45 +02:00
parent b46c06042b
commit 506ccbd589
1 changed files with 5 additions and 5 deletions

View File

@ -194,13 +194,13 @@ extern "C" {
#define GENERIC_METHOD_HEAD(SELF_TYPE,SELF_OBJECT,function) \
if ( self->ACCESS_OBJECT == NULL ) { \
PyErr_SetString ( ProxyError, "Attempt to call " function " on an unbound hurricane object" ); \
return ( NULL ); \
PyErr_SetString( ProxyError, "Attempt to call " function " on an unbound hurricane object" ); \
return NULL; \
} \
SELF_TYPE* SELF_OBJECT = dynamic_cast<SELF_TYPE*>(self->ACCESS_OBJECT);\
if ( self->ACCESS_OBJECT == NULL ) { \
PyErr_SetString ( ProxyError, "Invalid dynamic_cast while calling " function "" ); \
return ( NULL ); \
if ( SELF_OBJECT == NULL ) { \
PyErr_SetString( ProxyError, "Invalid dynamic_cast<> while calling " function "" ); \
return NULL; \
}