Bug #77322 [Ver->Csd]: PharData::addEmptyDir('/') Possible integer overflow

From: Date: Tue, 15 Dec 2020 10:47:40 +0000
Subject: Bug #77322 [Ver->Csd]: PharData::addEmptyDir('/') Possible integer overflow
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231094@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77322&edit=1 ID: 77322 Updated by: cmb@php.net Reported by: lars at larsegon dot se Summary: PharData::addEmptyDir('/') Possible integer overflow -Status: Verified +Status: Closed Type: Bug Package: PHAR related Operating System: Linux PHP Version: 7.1.25 Assigned To: cmb Block user comment: N Private report: N New Comment: Automatic comment on behalf of cmbecker69@gmx.de Revision: http://git.php.net/?p=php-src.git;a=commit;h=a53d67ceac301cbd27c4f0f716d4fbcdb7db3407 Log: Fix #77322: PharData::addEmptyDir('/') Possible integer overflow Previous Comments: ------------------------------------------------------------------------ [2020-12-11 15:58:13] cmb@php.net The following pull request has been associated: Patch Name: Fix #77322: PharData::addEmptyDir('/') Possible integer overflow On GitHub: https://github.com/php/php-src/pull/6508 Patch: https://github.com/php/php-src/pull/6508.patch ------------------------------------------------------------------------ [2018-12-20 10:21:59] lars at larsegon dot se Description: ------------ When trying to add the empty directory '/' to a phar archive PHP throws a fatal error: PHP Fatal error: Possible integer overflow in memory allocation (1 * 18446744073709551615 + 1) in /path/to/my/script.php on line 91 The same action works in ZipArchive, i.e. this works: $zip = new \ZipArchive; $zip->open(tempnam(sys_get_temp_dir(), "phptest")); $zip->addEmptyDir("/"); Test script: --------------- $tar = new \PharData("/tmp/phptempfile"); $tar->addEmptyDir("/"); // Fatal error Possible Integer overflow ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77322&edit=1

« previous php.bugs (#231094) next »