php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73719 Suspect memory issue with certain tar.gz file / PharData
Submitted: 2016-12-11 22:29 UTC Modified: 2020-10-25 13:43 UTC
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: tklingenberg at lastflood dot net Assigned: cmb (profile)
Status: Closed Package: PHAR related
PHP Version: 7.0.14 OS: Tested on Ubuntu 16.04
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tklingenberg at lastflood dot net
New email:
PHP Version: OS:

 

 [2016-12-11 22:29 UTC] tklingenberg at lastflood dot net
Description:
------------
One user reported an issue that a tar-gz data-file for the Magento application didn't run with Magerun that uses Composer which then uses the PharData class under the hood.

File in question is:

URL: https://sourceforge.net/projects/mageloads/files/assets/1.9.2.4/magento-sample-data-1.9.2.4.tar.gz

SHASUM: `5ad29dc3df38d21b2407c49f66d5308b01961d60

Creating the instance based on that file:

    php -r '$p = new PharData($argv[1]);' -- magento-sample-data-1.9.2.4.tar.gz 

Creates the always reproduceable error:

PHP Fatal error:  Allowed memory size of -1 bytes exhausted (tried to allocate 18446744073709543424 bytes) in Command line code on line 1

This large number looked suspicious to me so I reported this under security. I have not further looked into it.

The tar-file itself is somewhat broken, if I verify it on my system I get some errors:

$ tar -tzf magento-sample-data-1.9.2.4.tar.gz >/dev/null

gzip: stdin: decompression OK, trailing garbage ignored
tar: Child returned status 2
tar: Error is not recoverable: exiting now

I hope the information provided is useful.

Ref; https://github.com/netz98/n98-magerun/issues/879



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-27 07:01 UTC] stas@php.net
-Type: Security +Type: Bug
 [2016-12-27 07:01 UTC] stas@php.net
Don't see security problem here.
 [2020-10-13 12:50 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-10-13 12:50 UTC] cmb@php.net
<https://github.com/netz98/n98-magerun/issues/879> has been closed
as resolved; is there still an issue with PharData?
 [2020-10-25 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2020-10-25 11:57 UTC] tklingenberg at lastflood dot net
-Status: No Feedback +Status: Closed
 [2020-10-25 11:57 UTC] tklingenberg at lastflood dot net
Thanks for the reminder @cmb,

> is there still an issue with PharData?

I checked it across all versions I have on my system quickly at hand (5.6 - 8.0 RC) and it is fixed in 7.1. Looks like 5.6 and 7.0 had issues.

this looks fixed to me, closing.

find following only the report of the tests:


php 5.6: PHP 5.6.40-35+ubuntu18.04.1+deb.sury.org+1 (cli) : 
Fatal error: Allowed memory size of -1 bytes exhausted (tried to allocate 18446744073709543424 bytes) in Command line code on line 1
fail.
php5.6 -dextension=phar.so -nr $p = new PharData($argv[1]); -- magento-sample-data-1.9.2.4.tar.gz
non-zero exit status: 255 [FAIL]
--
php 7.0: PHP 7.0.33-34+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Oct 18 2020 21:14:27) ( NTS ): 
mmap() failed: [12] Cannot allocate memory

mmap() failed: [12] Cannot allocate memory

Fatal error: Out of memory (allocated 2097152) (tried to allocate 18446744073709543424 bytes) in Command line code on line 1
fail.
php7.0 -dextension=phar.so -nr $p = new PharData($argv[1]); -- magento-sample-data-1.9.2.4.tar.gz
non-zero exit status: 255 [FAIL]
--
php 7.1: PHP 7.1.33-21+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Oct 18 2020 21:17:19) ( NTS ): [ OK ]
--
php 7.2: PHP 7.2.34-4+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Oct 18 2020 21:19:33) ( NTS ): [ OK ]
--
php 7.3: PHP 7.3.23-4+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Oct 18 2020 21:21:27) ( NTS ): [ OK ]
--
php 7.4: PHP 7.4.11 (cli) (built: Oct 18 2020 19:39:25) ( NTS ): [ OK ]
--
php 8.0: PHP 8.0.0rc1 (cli) (built: Oct 18 2020 19:43:26) ( NTS ): [ OK ]
--

file:

-rw-rw-r-- 1 usr grp 436207616 Okt 25 12:16 magento-sample-data-1.9.2.4.tar.gz
magento-sample-data-1.9.2.4.tar.gz: gzip compressed data, was "magento-sample-data-1.9.2.4.tar", last modified: Mon Feb 22 15:49:22 2016, max compression, from FAT filesystem (MS-DOS, OS/2, NT)
SHA-1: 5ad29dc3df38d21b2407c49f66d5308b01961d60  magento-sample-data-1.9.2.4.tar.gz
SHA-256: c4557f8a73ca2773f6c91b1b3b40464a8f00fa902b73edc7fddb263f125f8b7c  magento-sample-data-1.9.2.4.tar.gz
 [2020-10-25 13:43 UTC] cmb@php.net
Thanks for thoroughly checking with different PHP versions!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 23:01:30 2024 UTC