Bug #66885 [Opn->Nab]: fileinfo: tried to allocate 140162101026128 bytes

From: Date: Thu, 24 Nov 2016 15:01:41 +0000
Subject: Bug #66885 [Opn->Nab]: fileinfo: tried to allocate 140162101026128 bytes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205609@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66885&edit=1 ID: 66885 Updated by: ab@php.net Reported by: pratte at cybergeneration dot com Summary: fileinfo: tried to allocate 140162101026128 bytes -Status: Open +Status: Not a bug Type: Bug Package: Reproducible crash Operating System: Slackware x64 14.1 PHP Version: 5.5.10 Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2014-03-11 18:49:29] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=66885&edit=1

« previous php.bugs (#205609) next »