pajoye          Sun Oct  8 17:36:10 2006 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/gd/tests       bug39082.phpt 

  Modified files:              
    /php-src/ext/gd     gd_ctx.c 
  Log:
  - #39082, image* segfaults when used with only one argument
    (introduced in 5.2+, no news entry)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd_ctx.c?r1=1.22.2.5.2.1&r2=1.22.2.5.2.2&diff_format=u
Index: php-src/ext/gd/gd_ctx.c
diff -u php-src/ext/gd/gd_ctx.c:1.22.2.5.2.1 
php-src/ext/gd/gd_ctx.c:1.22.2.5.2.2
--- php-src/ext/gd/gd_ctx.c:1.22.2.5.2.1        Tue Aug  1 22:42:11 2006
+++ php-src/ext/gd/gd_ctx.c     Sun Oct  8 17:36:10 2006
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: gd_ctx.c,v 1.22.2.5.2.1 2006/08/01 22:42:11 tony2001 Exp $ */
+/* $Id: gd_ctx.c,v 1.22.2.5.2.2 2006/10/08 17:36:10 pajoye Exp $ */
 
 #include "php_gd.h"
 
@@ -75,7 +75,9 @@
        ZEND_FETCH_RESOURCE(im, gdImagePtr, imgind, -1, "Image", 
phpi_get_le_gd());
 
        if (argc > 1) {
-               convert_to_string_ex(file);
+               if (argc >= 2 && Z_TYPE_PP(file) != IS_NULL) {
+                       convert_to_string_ex(file);
+               }
                fn = Z_STRVAL_PP(file);
                if (argc >= 3) {
                        convert_to_long_ex(quality);
@@ -87,7 +89,7 @@
                }
        }
 
-       if ((argc == 2) || (argc > 2 && Z_STRLEN_PP(file))) {
+       if (argc > 1 && (Z_TYPE_PP(file) != IS_NULL && ((argc == 2) || (argc > 
2 && Z_STRLEN_PP(file))))) {
 
                PHP_GD_CHECK_OPEN_BASEDIR(fn, "Invalid filename");
 

http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/bug39082.phpt?view=markup&rev=1.1
Index: php-src/ext/gd/tests/bug39082.phpt
+++ php-src/ext/gd/tests/bug39082.phpt

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

Reply via email to