From e6e242f41801ef4272a0a37f762adafa28ddee5c Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Wed, 25 Apr 2007 11:19:10 +0000 Subject: [PATCH] MFB: Fix crashes when SAPI handlers are overriden in dl()-ed extensions --- main/SAPI.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/main/SAPI.c b/main/SAPI.c index 3b75fcdc7e..d22142d9a2 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -794,6 +794,10 @@ SAPI_API int sapi_register_post_entries(sapi_post_entry *post_entries TSRMLS_DC) SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry TSRMLS_DC) { + if (EG(in_execution)) { + return FAILURE; + } + return zend_hash_add(&SG(known_post_content_types), post_entry->content_type, post_entry->content_type_len+1, (void *) post_entry, sizeof(sapi_post_entry), NULL); @@ -801,6 +805,9 @@ SAPI_API int sapi_register_post_entry(sapi_post_entry *post_entry TSRMLS_DC) SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry TSRMLS_DC) { + if (EG(in_execution)) { + return; + } zend_hash_del(&SG(known_post_content_types), post_entry->content_type, post_entry->content_type_len+1); } @@ -808,6 +815,10 @@ SAPI_API void sapi_unregister_post_entry(sapi_post_entry *post_entry TSRMLS_DC) SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRMLS_D)) { + TSRMLS_FETCH(); + if (EG(in_execution)) { + return FAILURE; + } sapi_module.default_post_reader = default_post_reader; return SUCCESS; } @@ -815,12 +826,20 @@ SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(TSRML SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC)) { + TSRMLS_FETCH(); + if (EG(in_execution)) { + return FAILURE; + } sapi_module.treat_data = treat_data; return SUCCESS; } SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC)) { + TSRMLS_FETCH(); + if (EG(in_execution)) { + return FAILURE; + } sapi_module.input_filter = input_filter; return SUCCESS; } -- 2.40.0