cvs: php-src /ext/pspell pspell.c

From: Date: Mon, 12 Sep 2005 15:26:49 +0000
Subject: cvs: php-src /ext/pspell pspell.c
Groups: php.cvs 
iliaa		Mon Sep 12 11:26:49 2005 EDT

  Modified files:              
    /php-src/ext/pspell	pspell.c 
  Log:
  Fixed bug #34456 (Possible crash inside pspell extension).
  
  # Patch by Nuno Lopes
  
  
http://cvs.php.net/diff.php/php-src/ext/pspell/pspell.c?r1=1.45&r2=1.46&ty=u
Index: php-src/ext/pspell/pspell.c
diff -u php-src/ext/pspell/pspell.c:1.45 php-src/ext/pspell/pspell.c:1.46
--- php-src/ext/pspell/pspell.c:1.45	Wed Aug  3 10:07:42 2005
+++ php-src/ext/pspell/pspell.c	Mon Sep 12 11:26:48 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: pspell.c,v 1.45 2005/08/03 14:07:42 sniper Exp $ */
+/* $Id: pspell.c,v 1.46 2005/09/12 15:26:48 iliaa Exp $ */
 
 #define IS_EXT_MODULE
 
@@ -697,6 +697,7 @@
 	zval **sccin, **runtogether;
 	int argc;
 
+	PspellManager *manager;
 	PspellConfig *config;
 	
 	argc = ZEND_NUM_ARGS();
@@ -705,12 +706,13 @@
 	}
 
 	convert_to_long_ex(sccin);
-	config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
-	if(!config){
+	manager = (PspellManager *) zend_list_find(Z_LVAL_PP(sccin), &type);
+	if(!manager){
 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(sccin));
 		RETURN_FALSE;
 	}
 
+	config = pspell_manager_config(manager);
 	convert_to_boolean_ex(runtogether);
 	pspell_config_replace(config, "run-together", Z_LVAL_PP(runtogether) ? "true" : "false");
 	
@@ -726,6 +728,7 @@
 	zval **sccin, **mode;
 	int argc;
 
+	PspellManager *manager;
 	PspellConfig *config;
 	
 	argc = ZEND_NUM_ARGS();
@@ -734,12 +737,13 @@
 	}
 
 	convert_to_long_ex(sccin);
-	config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
-	if(!config){
+	manager = (PspellManager *) zend_list_find(Z_LVAL_PP(sccin), &type);
+	if(!manager){
 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(sccin));
 		RETURN_FALSE;
 	}
 
+	config = pspell_manager_config(manager);
 	convert_to_long_ex(mode);
 
 	/* First check what mode we want (how many suggestions) */
@@ -767,6 +771,7 @@
 	char ignore_str[PSPELL_LARGEST_WORD + 1];	
 	long ignore = 0L;
 
+	PspellManager *manager;
 	PspellConfig *config;
 	
 	argc = ZEND_NUM_ARGS();
@@ -775,12 +780,13 @@
 	}
 
 	convert_to_long_ex(sccin);
-	config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
-	if(!config){
+	manager = (PspellManager *) zend_list_find(Z_LVAL_PP(sccin), &type);
+	if(!manager){
 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(sccin));
 		RETURN_FALSE;
 	}
 
+	config = pspell_manager_config(manager);
 	convert_to_long_ex(pignore);
 	ignore = Z_LVAL_PP(pignore);
 
@@ -810,6 +816,7 @@
 	int type;
 	zval **sccin, **value;
 	int argc;
+	PspellManager *manager;
 	PspellConfig *config;
 	
 	argc = ZEND_NUM_ARGS();
@@ -818,12 +825,13 @@
 	}
 
 	convert_to_long_ex(sccin);
-	config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
-	if (!config) {
+	manager = (PspellManager *) zend_list_find(Z_LVAL_PP(sccin), &type);
+	if (!manager) {
 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(sccin));
 		RETURN_FALSE;
 	}
 
+	config = pspell_manager_config(manager);
 	convert_to_string_ex(value);
 
 	if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(value), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
@@ -871,6 +879,7 @@
 	zval **sccin, **repl;
 	int argc;
 
+	PspellManager *manager;
 	PspellConfig *config;
 	
 	argc = ZEND_NUM_ARGS();
@@ -879,12 +888,13 @@
 	}
 
 	convert_to_long_ex(sccin);
-	config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
-	if(!config){
+	manager = (PspellManager *) zend_list_find(Z_LVAL_PP(sccin), &type);
+	if(!manager){
 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(sccin));
 		RETURN_FALSE;
 	}
 
+	config = pspell_manager_config(manager);
 	pspell_config_replace(config, "save-repl", "true");
 
 	convert_to_string_ex(repl);
@@ -911,6 +921,7 @@
 	zval **sccin, **save;
 	int argc;
 
+	PspellManager *manager;
 	PspellConfig *config;
 	
 	argc = ZEND_NUM_ARGS();
@@ -919,12 +930,13 @@
 	}
 
 	convert_to_long_ex(sccin);
-	config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
-	if(!config){
+	manager = (PspellManager *) zend_list_find(Z_LVAL_PP(sccin), &type);
+	if(!manager){
 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a PSPELL config index", Z_LVAL_PP(sccin));
 		RETURN_FALSE;
 	}
 
+	config = pspell_manager_config(manager);
 	convert_to_boolean_ex(save);
 	pspell_config_replace(config, "save-repl", Z_LVAL_PP(save) ? "true" : "false");
 

« previous php.cvs (#33922) next »