moriyoshi               Mon Jan 13 06:00:24 2003 EDT

  Modified files:              
    /php4/ext/standard  filters.c 
  Log:
  Fixed a silly segfault bug caused by lack of strict type checking
  
  
Index: php4/ext/standard/filters.c
diff -u php4/ext/standard/filters.c:1.14 php4/ext/standard/filters.c:1.15
--- php4/ext/standard/filters.c:1.14    Mon Jan 13 05:21:40 2003
+++ php4/ext/standard/filters.c Mon Jan 13 06:00:22 2003
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: filters.c,v 1.14 2003/01/13 10:21:40 moriyoshi Exp $ */
+/* $Id: filters.c,v 1.15 2003/01/13 11:00:22 moriyoshi Exp $ */
 
 #include "php.h"
 #include "php_globals.h"
@@ -1358,7 +1358,7 @@
                                                memcpy(buf, node_name, node_name_len);
                                                buf[node_name_len] = '\0';
 
-                                               if (zend_hash_find(Z_ARRVAL_P(node), 
buf, node_name_len + 1, (void **)&z_tmp) != SUCCESS) {
+                                               if (zend_hash_find(Z_ARRVAL_P(node), 
+buf, node_name_len + 1, (void **)&z_tmp) != SUCCESS || Z_TYPE_PP(z_tmp) != IS_ARRAY) {
                                                        zval *new_node;
                                                
                                                        MAKE_STD_ZVAL(new_node);
@@ -1456,10 +1456,14 @@
        write_conv_opts = read_conv_opts = NULL;
 
        if (strcasecmp(dot, "base64-encode") == 0) {
-               if (options != NULL && zend_hash_find(Z_ARRVAL_P(options), 
"base64-encode", sizeof("base64-encode"), (void **)&tmp_zval_pp) == SUCCESS) {
+               if (options != NULL &&
+                       zend_hash_find(Z_ARRVAL_P(options), "base64-encode", 
+sizeof("base64-encode"), (void **)&tmp_zval_pp) == SUCCESS &&
+                       Z_TYPE_PP(tmp_zval_pp) == IS_ARRAY) {
                        write_conv_opts = Z_ARRVAL_PP(tmp_zval_pp);     
                }
-               if (options != NULL && zend_hash_find(Z_ARRVAL_P(options), 
"base64-decode", sizeof("base64-decode"), (void **)&tmp_zval_pp) == SUCCESS) {
+               if (options != NULL &&
+                       zend_hash_find(Z_ARRVAL_P(options), "base64-decode", 
+sizeof("base64-decode"), (void **)&tmp_zval_pp) == SUCCESS &&
+                       Z_TYPE_PP(tmp_zval_pp) == IS_ARRAY) {
                        read_conv_opts = Z_ARRVAL_PP(tmp_zval_pp);      
                }
                if (php_convert_filter_ctor(inst,
@@ -1470,10 +1474,14 @@
                }       
                retval = php_stream_filter_alloc(&strfilter_convert_ops, inst, 
persistent);
        } else if (strcasecmp(dot, "base64-decode") == 0) {
-               if (options != NULL && zend_hash_find(Z_ARRVAL_P(options), 
"base64-decode", sizeof("base64-decode"), (void **)&tmp_zval_pp) == SUCCESS) {
+               if (options != NULL &&
+                       zend_hash_find(Z_ARRVAL_P(options), "base64-decode", 
+sizeof("base64-decode"), (void **)&tmp_zval_pp) == SUCCESS &&
+                       Z_TYPE_PP(tmp_zval_pp) == IS_ARRAY) {
                        write_conv_opts = Z_ARRVAL_PP(tmp_zval_pp);     
                }
-               if (options != NULL && zend_hash_find(Z_ARRVAL_P(options), 
"base64-encode", sizeof("base64-encode"), (void **)&tmp_zval_pp) == SUCCESS) {
+               if (options != NULL &&
+                       zend_hash_find(Z_ARRVAL_P(options), "base64-encode", 
+sizeof("base64-encode"), (void **)&tmp_zval_pp) == SUCCESS &&
+                       Z_TYPE_PP(tmp_zval_pp) == IS_ARRAY) {
                        read_conv_opts = Z_ARRVAL_PP(tmp_zval_pp);      
                }
                if (php_convert_filter_ctor(inst,
@@ -1484,7 +1492,9 @@
                }       
                retval = php_stream_filter_alloc(&strfilter_convert_ops, inst, 
persistent);
        } else if (strcasecmp(dot, "quoted-printable-encode") == 0) {
-               if (options != NULL && zend_hash_find(Z_ARRVAL_P(options), 
"quoted-printable-encode", sizeof("quoted-printable-encode"), (void **)&tmp_zval_pp) 
== SUCCESS) {
+               if (options != NULL &&
+                       zend_hash_find(Z_ARRVAL_P(options), "quoted-printable-encode", 
+sizeof("quoted-printable-encode"), (void **)&tmp_zval_pp) == SUCCESS &&
+                       Z_TYPE_PP(tmp_zval_pp) == IS_ARRAY) {
                        write_conv_opts = Z_ARRVAL_PP(tmp_zval_pp);     
                }
                if (options != NULL && zend_hash_find(Z_ARRVAL_P(options), 
"quoted-printable-decode", sizeof("quoted-printable-decode"), (void **)&tmp_zval_pp) 
== SUCCESS) {
@@ -1498,10 +1508,14 @@
                }       
                retval = php_stream_filter_alloc(&strfilter_convert_ops, inst, 
persistent);
        } else if (strcasecmp(dot, "quoted-printable-decode") == 0) {
-               if (options != NULL && zend_hash_find(Z_ARRVAL_P(options), 
"quoted-printable-decode", sizeof("quoted-printable-decode"), (void **)&tmp_zval_pp) 
== SUCCESS) {
+               if (options != NULL &&
+                       zend_hash_find(Z_ARRVAL_P(options), "quoted-printable-decode", 
+sizeof("quoted-printable-decode"), (void **)&tmp_zval_pp) == SUCCESS &&
+                       Z_TYPE_PP(tmp_zval_pp) == IS_ARRAY) {
                        write_conv_opts = Z_ARRVAL_PP(tmp_zval_pp);     
                }
-               if (options != NULL && zend_hash_find(Z_ARRVAL_P(options), 
"quoted-printable-encode", sizeof("quoted-printable-encode"), (void **)&tmp_zval_pp) 
== SUCCESS) {
+               if (options != NULL &&
+                       zend_hash_find(Z_ARRVAL_P(options), "quoted-printable-encode", 
+sizeof("quoted-printable-encode"), (void **)&tmp_zval_pp) == SUCCESS &&
+                       Z_TYPE_PP(tmp_zval_pp) == IS_ARRAY) {
                        read_conv_opts = Z_ARRVAL_PP(tmp_zval_pp);      
                }
                if (php_convert_filter_ctor(inst,



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to