Bug #77668 [Opn->Nab]: ZipArchive::close crashes

From: Date: Tue, 26 Feb 2019 10:26:14 +0000
Subject: Bug #77668 [Opn->Nab]: ZipArchive::close crashes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219735@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77668&edit=1 ID: 77668 Updated by: cmb@php.net Reported by: mario at snowpaws dot de Summary: ZipArchive::close crashes -Status: Open +Status: Not a bug Type: Bug Package: Zip Related Operating System: Windows 10/Windows 7 PHP Version: 7.3.2 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: I can confirm the segfault. It is, however, not a PHP but rather a libzip issue, since libzip calls localtime()[1] without checking whether it returns NULL (which it does on Windows, if a negative sourceTime is passed[2]). Please report this issue at <https://github.com/nih-at/libzip/>. [1] <https://github.com/nih-at/libzip/blob/rel-1-4-0/lib/zip_dirent.c#L1094> [2] <https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/localtime-localtime32-localtime64?view=vs-2017> Previous Comments: ------------------------------------------------------------------------ [2019-02-25 21:25:41] mario at snowpaws dot de Description: ------------ If the file date/time is set to -1, the method ZipArchive::close() crashes on windows. We used https://windows.php.net/downloads/releases/php-7.3.2-nts-Win32-VC15-x64.zip Test script: --------------- <?php echo "1"; $f=fopen('test.jpg', 'w'); fputs($f, 'foobar'); fclose($f); touch('test.jpg', -1); $zip=new ZipArchive(); $zip->open('test.zip', ZipArchive::CREATE); $zip->addFile('test.jpg','file'); $zip->close(); echo "2"; ?> Expected result: ---------------- Output: 12 Actual result: -------------- Output: 1 and only 1 temporally zip name is created, for example test.zip.1636f7f3 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77668&edit=1

« previous php.bugs (#219735) next »