From royal@home.altech.com.pl  Thu Jan 24 13:25:00 2002
Return-Path: <royal@home.altech.com.pl>
Received: from home.altech.com.pl (home.altech.com.pl [212.75.106.58])
	by hub.freebsd.org (Postfix) with ESMTP id 55EBE37B400
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 24 Jan 2002 13:24:56 -0800 (PST)
Received: (from royal@localhost)
	by home.altech.com.pl (8.11.6/8.11.6) id g0OLOr281551;
	Thu, 24 Jan 2002 22:24:53 +0100 (CET)
	(envelope-from royal)
Message-Id: <200201242124.g0OLOr281551@home.altech.com.pl>
Date: Thu, 24 Jan 2002 22:24:53 +0100 (CET)
From: Rafal Michalski <royal@altech.com.pl>
Reply-To: Rafal Michalski <royal@altech.com.pl>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: fix for port/www/mod_php4 zziplib extension
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         34238
>Category:       ports
>Synopsis:       fix for port/www/mod_php4 zziplib extension
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dirk
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 24 13:30:00 PST 2002
>Closed-Date:    Sat May 24 02:15:04 PDT 2003
>Last-Modified:  Sat May 24 02:15:04 PDT 2003
>Originator:     Rafal Michalski
>Release:        FreeBSD 4.4-STABLE i386
>Organization:
Altech
>Environment:
System: FreeBSD home.altech.com.pl 4.4-STABLE FreeBSD 4.4-STABLE #0: Fri Oct 5 18:04:14 CEST 2001 toor@home.altech.com.pl:/usr/obj/usr/src/sys/ROYAL i386

>Description:
	the php4 --with-zip configure option allows the use of zziplib to access .zip archive files
	php-4.1.x contains a bug which was fixed in CVS of php4-current

>How-To-Repeat:
	compile php4 with --with-zip option, and try to zip_read() any zip file
        php will core dump
>Fix:
the patch was posted to PHP bugtrack database by phpbug@robin.pfft.net :
put it there
file "www/mod_php4/files/patch-ext_zip_zip.c"

diff -u ext/zip/zip.c.orig ext/zip/zip.c
--- ext/zip/zip.c.orig  Fri Oct 19 10:04:24 2001
+++ ext/zip/zip.c       Thu Jan 24 21:33:23 2002
@@ -142,7 +142,7 @@
    Returns the next file in the archive */
 PHP_FUNCTION(zip_read)
 {
-    zval            **zzip_dp;
+    zval            *zzip_dp;
     ZZIP_DIR         *archive_p = NULL;
     php_zzip_dirent  *entry = NULL;
     int               ret;
@@ -151,7 +151,7 @@
            return;
        }
 
-    ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *, zzip_dp, -1, le_zip_dir_name, le_zip_dir);
+    ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *, &zzip_dp, -1, le_zip_dir_name, le_zip_dir);
 
     entry = emalloc(sizeof(php_zzip_dirent));
     ret = zzip_dir_read(archive_p, &entry->dirent);
@@ -169,16 +169,16 @@
    Close a Zip archive */
 PHP_FUNCTION(zip_close)
 {
-    zval     **zzip_dp;
+    zval     *zzip_dp;
     ZZIP_DIR  *archive_p = NULL;
 
     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zzip_dp) == FAILURE) {
            return;
        }
 
-    ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *, zzip_dp, -1, le_zip_dir_name, le_zip_dir);
+    ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *, &zzip_dp, -1, le_zip_dir_name, le_zip_dir);
 
-    zend_list_delete(Z_LVAL_PP(zzip_dp));
+    zend_list_delete(Z_LVAL_PP(&zzip_dp));
 }
 /* }}} */
 
@@ -186,14 +186,14 @@
  */
 static void php_zzip_get_entry(INTERNAL_FUNCTION_PARAMETERS, int opt)
 {
-    zval            **zzip_ent;
+    zval            *zzip_ent;
     php_zzip_dirent  *entry = NULL;
 
     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zzip_ent) == FAILURE) {
            return;
        }
 
-    ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, zzip_ent, -1, le_zip_entry_name, le_zip_entry);
+    ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, &zzip_ent, -1, le_zip_entry_name, le_zip_entry);
 
     switch (opt) {
     case 0:
@@ -248,17 +248,18 @@
    Open a Zip File, pointed by the resource entry */
 PHP_FUNCTION(zip_entry_open)
 {
-    zval            **zzip_dp;
-    zval            **zzip_ent;
+    zval            *zzip_dp;
+    zval            *zzip_ent;
     ZZIP_DIR         *archive_p = NULL;
     php_zzip_dirent  *entry = NULL;
-    int               mode;
+    char              *mode;
+    int               mode_len;
 
-    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|l", &zzip_dp, &zzip_ent, &mode) == FAILURE)
+    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr|s", &zzip_dp, &zzip_ent, &mode, &mode_len) == FAILURE)
     return;
 
-    ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *,        zzip_dp,  -1, le_zip_dir_name,   le_zip_dir);
-    ZEND_FETCH_RESOURCE(entry,     php_zzip_dirent *, zzip_ent, -1, le_zip_entry_name, le_zip_entry);
+    ZEND_FETCH_RESOURCE(archive_p, ZZIP_DIR *,        &zzip_dp,  -1, le_zip_dir_name,   le_zip_dir);
+    ZEND_FETCH_RESOURCE(entry,     php_zzip_dirent *, &zzip_ent, -1, le_zip_entry_name, le_zip_entry);
 
     entry->fp = zzip_file_open(archive_p, entry->dirent.d_name, O_RDONLY | O_BINARY);
 
@@ -274,7 +275,7 @@
    Read X bytes from an opened zip entry */
 PHP_FUNCTION(zip_entry_read)
 {
-    zval            **zzip_ent;
+    zval            *zzip_ent;
     php_zzip_dirent  *entry = NULL;
     char             *buf   = NULL;
     int               len   = 1024;
@@ -284,7 +285,7 @@
            return;
        }
     
-    ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, zzip_ent, -1, le_zip_entry_name, le_zip_entry);
+    ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, &zzip_ent, -1, le_zip_entry_name, le_zip_entry);
 
     buf = emalloc(len + 1);
     ret = zzip_read(entry->fp, buf, len);
@@ -300,16 +301,16 @@
    Close a zip entry */
 PHP_FUNCTION(zip_entry_close)
 {
-    zval            **zzip_ent;
+    zval            *zzip_ent;
     php_zzip_dirent  *entry = NULL;
 
     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zzip_ent) == FAILURE) {
                return;
        }
 
-    ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, zzip_ent, -1, le_zip_entry_name, le_zip_entry);
+    ZEND_FETCH_RESOURCE(entry, php_zzip_dirent *, &zzip_ent, -1, le_zip_entry_name, le_zip_entry);
 
-    zend_list_delete(Z_LVAL_PP(zzip_ent));
+    zend_list_delete(Z_LVAL_PP(&zzip_ent));
 }
 /* }}} */

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports->dirk 
Responsible-Changed-By: pat 
Responsible-Changed-When: Thu Jan 24 14:47:16 PST 2002 
Responsible-Changed-Why:  
Over to maintainer 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=34238 
State-Changed-From-To: open->closed 
State-Changed-By: nork 
State-Changed-When: Sat May 24 02:14:51 PDT 2003 
State-Changed-Why:  
Maybe fixed by updating to 4.3.2RC4. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=34238 
>Unformatted:
