pajoye          Sun Jun  3 21:21:57 2007 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src    NEWS 
    /php-src/ext/zip    php_zip.c 
    /php-src/ext/zip/tests      bug11216.phpt 
  Log:
  - pecl bug #11216, better fix, leak removed and improved test
  - typo in news, better late than never (-d) 
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.754&r2=1.2027.2.547.2.755&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.754 php-src/NEWS:1.2027.2.547.2.755
--- php-src/NEWS:1.2027.2.547.2.754     Sun Jun  3 20:28:33 2007
+++ php-src/NEWS        Sun Jun  3 21:21:56 2007
@@ -4,6 +4,8 @@
 - Improved fix for MOPB-03-2007. (Ilia)
 - Corrected fix for CVE-2007-2872. (Ilia)
 - Added GD version constants GD_MAJOR_VERSION, GD_MINOR_VERSION
+- Fixed crash in ZipArchive::addEmptyDir when a directory already
+  exists (pecl bug #11216) (Pierre)
   GD_RELEASE_VERSION, GD_EXTRA_VERSION and GD_VERSION_STRING. (Pierre)
 - Fixed bug #41576 (configure failure when using --without-apxs or some
   other SAPIs disabling options). (Jani)
@@ -24,7 +26,7 @@
 - Optimized digest generation in md5() and sha1() functions. (Ilia)
 - Upgraded bundled SQLite 3 to version 3.3.17. (Ilia)
 
-- Addded "max_input_nesting_level" php.ini option to limit nesting level of 
+- Added "max_input_nesting_level" php.ini option to limit nesting level of 
   input variables. Fix for MOPB-03-2007. (Stas)
 - Added a 4th parameter flag to htmlspecialchars() and htmlentities() that 
   makes the function not encode existing html entities. (Ilia)
http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.1.2.34&r2=1.1.2.35&diff_format=u
Index: php-src/ext/zip/php_zip.c
diff -u php-src/ext/zip/php_zip.c:1.1.2.34 php-src/ext/zip/php_zip.c:1.1.2.35
--- php-src/ext/zip/php_zip.c:1.1.2.34  Sun Jun  3 19:47:17 2007
+++ php-src/ext/zip/php_zip.c   Sun Jun  3 21:21:57 2007
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: php_zip.c,v 1.1.2.34 2007/06/03 19:47:17 pajoye Exp $ */
+/* $Id: php_zip.c,v 1.1.2.35 2007/06/03 21:21:57 pajoye Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -120,7 +120,7 @@
                        len = spprintf(&file_dirname_fullpath, 0, "%s", dest);
                }
 
-               php_basename(file, file_len, NULL, 0, &file_basename, (unsigned 
int *)&file_basename_len TSRMLS_CC);
+               php_basename(file, file_len, NULL, 0, &file_basename, (size_t 
*)&file_basename_len TSRMLS_CC);
 
                if (OPENBASEDIR_CHECKPATH(file_dirname_fullpath)) {
                        efree(file_dirname_fullpath);
@@ -1005,7 +1005,6 @@
        }
 
     if (dirname[dirname_len-1] != '/') {
-
                s=(char *)emalloc(dirname_len+2);
                strcpy(s, dirname);
                s[dirname_len] = '/';
@@ -1016,14 +1015,23 @@
 
        idx = zip_stat(intern, s, 0, &sb);
        if (idx >= 0) {
-               RETURN_FALSE;
-       }
+               RETVAL_FALSE;
+       } else {
+               /* reset the error */
+               if (intern->error.str) {
+                       _zip_error_fini(&intern->error);
+               }
+               _zip_error_init(&intern->error);
 
-       if (zip_add_dir(intern, (const char *)s) == -1) {
-               RETURN_FALSE;
+               if (zip_add_dir(intern, (const char *)s) == -1) {
+                       RETVAL_FALSE;
+               }
+               RETVAL_TRUE;
        }
 
-       RETURN_TRUE;
+       if (s != dirname) {
+               efree(s);
+       }
 }
 /* }}} */
 
@@ -2042,7 +2050,7 @@
        php_info_print_table_start();
 
        php_info_print_table_row(2, "Zip", "enabled");
-       php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 
1.1.2.34 2007/06/03 19:47:17 pajoye Exp $");
+       php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 
1.1.2.35 2007/06/03 21:21:57 pajoye Exp $");
        php_info_print_table_row(2, "Zip version", "2.0.0");
        php_info_print_table_row(2, "Libzip version", "0.7.1");
 
http://cvs.php.net/viewvc.cgi/php-src/ext/zip/tests/bug11216.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u
Index: php-src/ext/zip/tests/bug11216.phpt
diff -u php-src/ext/zip/tests/bug11216.phpt:1.1.2.1 
php-src/ext/zip/tests/bug11216.phpt:1.1.2.2
--- php-src/ext/zip/tests/bug11216.phpt:1.1.2.1 Sun Jun  3 19:50:36 2007
+++ php-src/ext/zip/tests/bug11216.phpt Sun Jun  3 21:21:57 2007
@@ -2,7 +2,7 @@
 Bug #11216 (::addEmptyDir() crashes when the directory already exists)
 --SKIPIF--
 <?php
-/* $Id: bug11216.phpt,v 1.1.2.1 2007/06/03 19:50:36 pajoye Exp $ */
+/* $Id: bug11216.phpt,v 1.1.2.2 2007/06/03 21:21:57 pajoye Exp $ */
 if(!extension_loaded('zip')) die('skip');
  ?>
 --FILE--
@@ -10,6 +10,7 @@
 $archive = new ZipArchive();
 $archive->open('__test.zip', ZIPARCHIVE::CREATE);
 var_dump($archive->addEmptyDir('test'));
+print_r($archive);
 var_dump($archive->addEmptyDir('test'));
 $archive->close();
 unlink('__test.zip');
@@ -21,7 +22,7 @@
     [status] => 0
     [statusSys] => 0
     [numFiles] => 1
-    [filename] =>
-    [comment] =>
+    [filename] => 
+    [comment] => 
 )
 bool(false)

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

Reply via email to