summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-lang/php/files/5.0.4/php5.0.4-pspell-ext-segf.patch')
-rw-r--r--dev-lang/php/files/5.0.4/php5.0.4-pspell-ext-segf.patch320
1 files changed, 320 insertions, 0 deletions
diff --git a/dev-lang/php/files/5.0.4/php5.0.4-pspell-ext-segf.patch b/dev-lang/php/files/5.0.4/php5.0.4-pspell-ext-segf.patch
new file mode 100644
index 0000000..5c32b14
--- /dev/null
+++ b/dev-lang/php/files/5.0.4/php5.0.4-pspell-ext-segf.patch
@@ -0,0 +1,320 @@
+--- ext/pspell/pspell.c 2004-05-18 14:32:05.000000000 +0200
++++ ext/pspell/pspell.c 2005-10-26 23:30:48.000000000 +0200
+@@ -2,7 +2,7 @@
+ +----------------------------------------------------------------------+
+ | PHP Version 5 |
+ +----------------------------------------------------------------------+
+- | Copyright (c) 1997-2004 The PHP Group |
++ | Copyright (c) 1997-2005 The PHP Group |
+ +----------------------------------------------------------------------+
+ | This source file is subject to version 3.0 of the PHP license, |
+ | that is bundled with this package in the file LICENSE, and is |
+@@ -16,7 +16,7 @@
+ +----------------------------------------------------------------------+
+ */
+
+-/* $Id: pspell.c,v 1.44 2004/05/18 12:32:05 edink Exp $ */
++/* $Id: pspell.c,v 1.47 2005/10/17 15:29:55 iliaa Exp $ */
+
+ #define IS_EXT_MODULE
+
+@@ -101,6 +101,22 @@
+ delete_pspell_config(config);
+ }
+
++#define PSPELL_FETCH_CONFIG \
++ convert_to_long_ex(conf); \
++ config = (PspellConfig *) zend_list_find(Z_LVAL_PP(conf), &type); \
++ if (config == NULL || type != le_pspell_config) { \
++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(conf)); \
++ RETURN_FALSE; \
++ } \
++
++#define PSPELL_FETCH_MANAGER \
++ convert_to_long_ex(scin); \
++ manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type); \
++ if (!manager || type != le_pspell) { \
++ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL result index", Z_LVAL_PP(scin)); \
++ RETURN_FALSE; \
++ } \
++
+ /* {{{ PHP_MINIT_FUNCTION
+ */
+ PHP_MINIT_FUNCTION(pspell)
+@@ -352,13 +368,7 @@
+ WRONG_PARAM_COUNT;
+ }
+
+- convert_to_long_ex(conf);
+- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(conf), &type);
+-
+- if (config == NULL || type != le_pspell_config) {
+- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(conf));
+- RETURN_FALSE;
+- }
++ PSPELL_FETCH_CONFIG;
+
+ ret = new_pspell_manager(config);
+
+@@ -387,13 +397,9 @@
+ WRONG_PARAM_COUNT;
+ }
+
+- convert_to_long_ex(scin);
+ convert_to_string_ex(word);
+- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
+- if(!manager){
+- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL result index", Z_LVAL_PP(scin));
+- RETURN_FALSE;
+- }
++
++ PSPELL_FETCH_MANAGER;
+
+ if(pspell_manager_check(manager, Z_STRVAL_PP(word))){
+ RETURN_TRUE;
+@@ -419,13 +425,8 @@
+ WRONG_PARAM_COUNT;
+ }
+
+- convert_to_long_ex(scin);
+ convert_to_string_ex(word);
+- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
+- if(!manager){
+- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL result index", Z_LVAL_PP(scin));
+- RETURN_FALSE;
+- }
++ PSPELL_FETCH_MANAGER;
+
+ array_init(return_value);
+
+@@ -457,14 +458,9 @@
+ WRONG_PARAM_COUNT;
+ }
+
+- convert_to_long_ex(scin);
+ convert_to_string_ex(miss);
+ convert_to_string_ex(corr);
+- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
+- if(!manager){
+- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL result index", Z_LVAL_PP(scin));
+- RETURN_FALSE;
+- }
++ PSPELL_FETCH_MANAGER;
+
+ pspell_manager_store_replacement(manager, Z_STRVAL_PP(miss), Z_STRVAL_PP(corr));
+ if(pspell_manager_error_number(manager) == 0){
+@@ -490,13 +486,8 @@
+ WRONG_PARAM_COUNT;
+ }
+
+- convert_to_long_ex(scin);
+ convert_to_string_ex(word);
+- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
+- if(!manager){
+- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL result index", Z_LVAL_PP(scin));
+- RETURN_FALSE;
+- }
++ PSPELL_FETCH_MANAGER;
+
+ /*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/
+ if(Z_STRLEN_PP(word) == 0){
+@@ -527,13 +518,8 @@
+ WRONG_PARAM_COUNT;
+ }
+
+- convert_to_long_ex(scin);
+ convert_to_string_ex(word);
+- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
+- if(!manager){
+- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL result index", Z_LVAL_PP(scin));
+- RETURN_FALSE;
+- }
++ PSPELL_FETCH_MANAGER;
+
+ /*If the word is empty, we have to return; otherwise we'll segfault! ouch!*/
+ if(Z_STRLEN_PP(word) == 0){
+@@ -564,12 +550,7 @@
+ WRONG_PARAM_COUNT;
+ }
+
+- convert_to_long_ex(scin);
+- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
+- if(!manager){
+- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL result index", Z_LVAL_PP(scin));
+- RETURN_FALSE;
+- }
++ PSPELL_FETCH_MANAGER;
+
+ pspell_manager_clear_session(manager);
+ if(pspell_manager_error_number(manager) == 0){
+@@ -595,12 +576,7 @@
+ WRONG_PARAM_COUNT;
+ }
+
+- convert_to_long_ex(scin);
+- manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
+- if(!manager){
+- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL result index", Z_LVAL_PP(scin));
+- RETURN_FALSE;
+- }
++ PSPELL_FETCH_MANAGER;
+
+ pspell_manager_save_all_word_lists(manager);
+
+@@ -694,22 +670,17 @@
+ PHP_FUNCTION(pspell_config_runtogether)
+ {
+ int type;
+- zval **sccin, **runtogether;
++ zval **conf, **runtogether;
+ int argc;
+
+ PspellConfig *config;
+
+ argc = ZEND_NUM_ARGS();
+- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&runtogether) == FAILURE) {
++ if (argc != 2 || zend_get_parameters_ex(argc,&conf,&runtogether) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+- convert_to_long_ex(sccin);
+- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
+- if(!config){
+- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(sccin));
+- RETURN_FALSE;
+- }
++ PSPELL_FETCH_CONFIG;
+
+ convert_to_boolean_ex(runtogether);
+ pspell_config_replace(config, "run-together", Z_LVAL_PP(runtogether) ? "true" : "false");
+@@ -723,22 +694,17 @@
+ PHP_FUNCTION(pspell_config_mode)
+ {
+ int type;
+- zval **sccin, **mode;
++ zval **conf, **mode;
+ int argc;
+
+ PspellConfig *config;
+
+ argc = ZEND_NUM_ARGS();
+- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&mode) == FAILURE) {
++ if (argc != 2 || zend_get_parameters_ex(argc,&conf,&mode) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+- convert_to_long_ex(sccin);
+- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
+- if(!config){
+- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(sccin));
+- RETURN_FALSE;
+- }
++ PSPELL_FETCH_CONFIG;
+
+ convert_to_long_ex(mode);
+
+@@ -760,7 +726,7 @@
+ PHP_FUNCTION(pspell_config_ignore)
+ {
+ int type;
+- zval **sccin, **pignore;
++ zval **conf, **pignore;
+ int argc;
+
+ int loc = PSPELL_LARGEST_WORD;
+@@ -770,16 +736,11 @@
+ PspellConfig *config;
+
+ argc = ZEND_NUM_ARGS();
+- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&pignore) == FAILURE) {
++ if (argc != 2 || zend_get_parameters_ex(argc,&conf,&pignore) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+- convert_to_long_ex(sccin);
+- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
+- if(!config){
+- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(sccin));
+- RETURN_FALSE;
+- }
++ PSPELL_FETCH_CONFIG;
+
+ convert_to_long_ex(pignore);
+ ignore = Z_LVAL_PP(pignore);
+@@ -808,21 +769,16 @@
+ static void pspell_config_path(INTERNAL_FUNCTION_PARAMETERS, char *option)
+ {
+ int type;
+- zval **sccin, **value;
++ zval **conf, **value;
+ int argc;
+ PspellConfig *config;
+
+ argc = ZEND_NUM_ARGS();
+- if (argc != 2 || zend_get_parameters_ex(argc, &sccin, &value) == FAILURE) {
++ if (argc != 2 || zend_get_parameters_ex(argc, &conf, &value) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+- convert_to_long_ex(sccin);
+- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
+- if (!config) {
+- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(sccin));
+- RETURN_FALSE;
+- }
++ PSPELL_FETCH_CONFIG;
+
+ convert_to_string_ex(value);
+
+@@ -868,22 +824,17 @@
+ PHP_FUNCTION(pspell_config_repl)
+ {
+ int type;
+- zval **sccin, **repl;
++ zval **conf, **repl;
+ int argc;
+
+ PspellConfig *config;
+
+ argc = ZEND_NUM_ARGS();
+- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&repl) == FAILURE) {
++ if (argc != 2 || zend_get_parameters_ex(argc,&conf,&repl) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+- convert_to_long_ex(sccin);
+- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
+- if(!config){
+- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(sccin));
+- RETURN_FALSE;
+- }
++ PSPELL_FETCH_CONFIG;
+
+ pspell_config_replace(config, "save-repl", "true");
+
+@@ -908,22 +859,17 @@
+ PHP_FUNCTION(pspell_config_save_repl)
+ {
+ int type;
+- zval **sccin, **save;
++ zval **conf, **save;
+ int argc;
+
+ PspellConfig *config;
+
+ argc = ZEND_NUM_ARGS();
+- if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&save) == FAILURE) {
++ if (argc != 2 || zend_get_parameters_ex(argc,&conf,&save) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+- convert_to_long_ex(sccin);
+- config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
+- if(!config){
+- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(sccin));
+- RETURN_FALSE;
+- }
++ PSPELL_FETCH_CONFIG;
+
+ convert_to_boolean_ex(save);
+ pspell_config_replace(config, "save-repl", Z_LVAL_PP(save) ? "true" : "false");