Bug #78987 [Com]: Memory problems running finfo::buffer with PHP_CLI

From: Date: Wed, 23 Jun 2021 07:01:16 +0000
Subject: Bug #78987 [Com]: Memory problems running finfo::buffer with PHP_CLI
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234596@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78987&edit=1 ID: 78987 Comment by: andrei at davisinfo dot ro Reported by: jhhillie at amazon dot com Summary: Memory problems running finfo::buffer with PHP_CLI Status: Verified Type: Bug Package: Filesystem function related Operating System: Ubuntu PHP Version: 7.4Git-2019-12-18 (Git) Block user comment: N Private report: N New Comment: It was fixed on master because code was updated to file version 5.40 which fixes this issue but I think applying the fix to earlier versions would be a good idea also. Previous Comments: ------------------------------------------------------------------------ [2021-06-23 06:48:35] andrei at davisinfo dot ro The following patch has been added/updated: Patch Name: fix-encoding-memory-allocation-too-big Revision: 1624430915 URL: https://bugs.php.net/patch-display.php?bug=78987&patch=fix-encoding-memory-allocation-too-big&revision=1624430915 ------------------------------------------------------------------------ [2021-06-16 11:07:59] info at it-can dot nl any news on this bug and the fix? ------------------------------------------------------------------------ [2021-02-06 06:58:26] halaeiv at gmail dot com I have reported to bug to file package https://bugs.astron.com/view.php?id=234 and they fixed it really quickly: "file_buffer(3) passed the full size of the buffer to the encoding determination function. If the file was too large, we ended up allocating (2 * size + 4 * size) buffers to scan for encoding. Now we limit size to 64K." Can we have this fix in PHP soon? Thanks ------------------------------------------------------------------------ [2021-02-04 11:00:18] halaeiv at gmail dot com I have a quick question. If it is libmagic bug how come the bug exists in php-7.4 but not php-7.2? Both are installed via ondrej/php in Ubuntu and both packages depend on the same libmagic1. If 2 php versions depends on the same shared library and one has a bug, doesn't this mean the bug is actually not in the shared library? ------------------------------------------------------------------------ [2020-06-12 07:12:11] magnar at myrtveit dot com I've created two scripts that illustrate the problem with finfo_buffer: Memory usage of finfo_file: https://3v4l.org/M3YLG Memory usage of finfo_buffer: https://3v4l.org/LNNoV On a 16M file, finfo_file uses 20M memory. finfo_buffer, however, uses 244M! ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=78987 -- Edit this bug report at https://bugs.php.net/bug.php?id=78987&edit=1

« previous php.bugs (#234596) next »