php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66885 fileinfo: tried to allocate 140162101026128 bytes
Submitted: 2014-03-11 18:49 UTC Modified: 2016-11-24 15:01 UTC
Votes:8
Avg. Score:4.0 ± 1.0
Reproduced:8 of 8 (100.0%)
Same Version:4 (50.0%)
Same OS:1 (12.5%)
From: pratte at cybergeneration dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.5.10 OS: Slackware x64 14.1
Private report: No CVE-ID: None
 [2014-03-11 18:49 UTC] pratte at cybergeneration dot com
Description:
------------
Allowed memory size exhausted:

[Tue Mar 11 14:38:04.043122 2014] [:error] [pid 4606:tid 140163304847104] [client 192.168.0.14:47690] PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 140162101026128 bytes) in Unknown on line 0

This code (below in Test script) was used in PHP 5.2 and was working fine. Upgraded to PHP 5.5.10 and we got those crashes. Removing the path to a magic database fixes the problem, but I'm still pretty curious about what's being logged in error_log, especially 'tried to allocate 140162101026128 bytes', that makes no sense to me

Test script:
---------------
$handle = new finfo(FILEINFO_MIME_TYPE, "/etc/file/magic.mgc");

The error goes away if we are using this instead:

$handle = new finfo(FILEINFO_MIME_TYPE);

Expected result:
----------------
Other thing I noticed is that the 'tried to allocate' bytes seem to be pretty similar to the Thread ID (tid) in the logs as well:

# grep "bytes exhausted" /var/www/logs/error_log | awk '{ print "Tid:" $9, "Exhausted:" $25; }' | sed 's/]//g'
Tid:140232007603968 Exhausted:140231237030816
Tid:140231999211264 Exhausted:140231845865648
Tid:140231948855040 Exhausted:140231845853360
Tid:140231940462336 Exhausted:140231847975088
Tid:140231957247744 Exhausted:140230820510528
Tid:140231932069632 Exhausted:140230690544128
Tid:140231940462336 Exhausted:140230901551760
Tid:140231864928000 Exhausted:140231845865648
Tid:140231932069632 Exhausted:140230283629488
Tid:140231890106112 Exhausted:140230216520624
Tid:140231873320704 Exhausted:140230420013472
Tid:140231890106112 Exhausted:140230285535344
Tid:140231923676928 Exhausted:140230758178176
Tid:140231881713408 Exhausted:140230554527856
Tid:140231864928000 Exhausted:140230216520624
Tid:140231873320704 Exhausted:140230151577184
Tid:140231915284224 Exhausted:140230350738352
Tid:140232015996672 Exhausted:140231492041808
Tid:140232015996672 Exhausted:140231426947520
Tid:140232120657664 Exhausted:140231695460112
Tid:140231974033152 Exhausted:140230961103872
Tid:140231965640448 Exhausted:140230688818752



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-24 15:01 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2016-11-24 15:01 UTC] ab@php.net
Thanks for the report. Versions of libmagic might use incompatible formats, so it's not easy interchangable. If you want to use an external magic file, you need to ensure the compatibility first.

Thanks.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 02:01:28 2024 UTC