Skip to content

Commit 4992934

Browse files
committed
Fixed segfault in intlgregcal_create_instance
1 parent f096bc4 commit 4992934

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ext/intl/calendar/gregoriancalendar_methods.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ U_CFUNC PHP_FUNCTION(intlgregcal_create_instance)
182182
_php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU);
183183

184184
if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) {
185-
zend_object_store_ctor_failed(Z_OBJ(orig) TSRMLS_CC);
185+
zval_dtor(&orig);
186+
RETURN_NULL();
186187
}
187188
}
188189

ext/intl/intl_data.h

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ typedef struct _intl_data {
6969
if( U_FAILURE( INTL_DATA_ERROR_CODE((obj)) ) ) \
7070
{ \
7171
intl_errors_set_custom_msg( INTL_DATA_ERROR_P((obj)), msg, 0 TSRMLS_CC ); \
72+
/* yes, this is ugly, but it alreay is */ \
73+
if (return_value != getThis()) { \
74+
zval_dtor(return_value); \
75+
RETURN_NULL(); \
76+
} \
7277
Z_OBJ_P(return_value) = NULL; \
7378
return; \
7479
}

0 commit comments

Comments
 (0)