Bug 13820 - PHP zip makes httpd crash when adding file to an archive.
Summary: PHP zip makes httpd crash when adding file to an archive.
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 4
Hardware: x86_64 Linux
Priority: Normal critical
Target Milestone: ---
Assignee: Oden Eriksson
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 14326
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-29 21:12 CEST by franck villaume
Modified: 2014-10-28 12:48 CET (History)
2 users (show)

See Also:
Source RPM: php-5.5.14-1.mga4.src.rpm
CVE:
Status comment:


Attachments

Description franck villaume 2014-07-29 21:12:28 CEST
Description of problem:
Using the PHP ZIP extension to create and adding files, httpd crashes.

Version-Release number of selected component (if applicable):
I'm running :
- lib64zip2-0.11.2-1.mga4
- apache-mod_php-5.5.14-1.mga4
- apache-2.4.7-5.1.mga4
- php-zip-5.5.14-1.mga4


How reproducible:

Here is a php sample code which should work correctly.
<?php
$za = new ZipArchive();
$flags = ZIPARCHIVE::CREATE;
if ($za->open('/tmp/test1.zip', $flags) === TRUE) {
	echo "OPEN OK\n";
	@unlink('/tmp/newfile.txt');
	fopen('/tmp/newfile.txt', 'x+');
 	if ($za->addFile('/tmp/newfile.txt', 'newfile.txt') === TRUE) {
 		echo "ADDFILE OK\n";
 	}
}
$za->addEmptyDir('tot/');
$za->addFromString('emptydir/newfile','mycontent');
$za->close();



Steps to Reproduce:
1. load the php script
2. httpd crashes


Reproducible: 

Steps to Reproduce:
Comment 1 David Walser 2014-08-01 15:18:11 CEST
Sounds like another libzip issue (we fixed a similar issue with the update to 0.11.2).  Strange though, Moodle uses php-zip to create zip files and it works fine.  I guess it doesn't add files to an existing archive though.

CC: (none) => luigiwalser
Assignee: bugsquad => oe

Comment 2 franck villaume 2014-08-01 15:21:25 CEST
Hi,

the addFromString function works perfectly. It may be the way moodle uses to create zip files.
the addFile function makes the httpd crashes.

Regards,
Comment 3 Rahel Neumann 2014-10-21 14:41:41 CEST
Hi, 

the error occurs with PHP 5.5.16 too. Only the function addFile is affected. The function addFromString works fine. I tried to add a file to a new created zip archive, not to an existing. 

Regards,

CC: (none) => rahel.neumann

Comment 4 Oden Eriksson 2014-10-21 15:54:00 CEST
This works in mbs1 with php-5.5.18 and libzip-0.10.1 (mga2). 

Please test php-zip-5.5.18-1.1.mga4 once it comes available.

My quick test showed the PECL version worked so I replaced the bundled one with the PECL one from http://pecl.php.net/get/zip-1.12.4.tgz
David Walser 2014-10-21 15:57:17 CEST

Depends on: (none) => 14326

Comment 5 Oden Eriksson 2014-10-21 15:59:54 CEST
For reference: php-5.6.2 already has zip-1.12.4 so this problem should be fixed there.

Depends on: 14326 => (none)

David Walser 2014-10-21 16:12:28 CEST

Depends on: (none) => 14326

David Walser 2014-10-27 17:04:57 CET

Depends on: 14326 => (none)

David Walser 2014-10-27 19:47:54 CET

Depends on: (none) => 14326

Comment 6 David Walser 2014-10-28 12:48:59 CET
Fixed by the update in Bug 14326.

Status: NEW => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.