Bug #79263 [Opn]: finfo_buffer fails with "PHP Fatal error: Allowed memory size of"

From: Date: Fri, 14 Feb 2020 17:14:53 +0000
Subject: Bug #79263 [Opn]: finfo_buffer fails with "PHP Fatal error: Allowed memory size of"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225582@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79263&edit=1 ID: 79263 User updated by: anestis at fraganestis dot eu Reported by: anestis at fraganestis dot eu Summary: finfo_buffer fails with "PHP Fatal error: Allowed memory size of" Status: Open Type: Bug Package: Unknown/Other Function Operating System: Debian 9 PHP Version: 7.4.2 Block user comment: N Private report: N New Comment: The error is produced when I use the following sequence: 1) read the data from a temp file into a buffer 2) call finfo_buffer to get the mimetype 3) parse the buffer The error is not produced and everything works fine if the sequence is modified as follows: 1) call finfo_file on temp file to get the mimetype 2) read the data from the same temp file into a buffer 3) parse the buffer Previous Comments: ------------------------------------------------------------------------ [2020-02-13 08:15:27] nikic@php.net This sounds similar to bug #78987. In any case, this is a bug in upstream libmagic, it needs to be reported and fixed there before we can do anything about it. ------------------------------------------------------------------------ [2020-02-13 05:15:01] anestis at fraganestis dot eu @requinix@php.net: It's a pdf file. Seems legit. The reader (foxit) opens it just fine. ------------------------------------------------------------------------ [2020-02-13 05:11:07] anestis at fraganestis dot eu @requinix@php.net: just over 17M (17318320 bytes). ------------------------------------------------------------------------ [2020-02-13 00:47:18] requinix@php.net @bugreports: Passing strings around does not allocate new memory because of copy-on-write. ------------------------------------------------------------------------ [2020-02-13 00:46:16] requinix@php.net @anestis: How large is $buffer, and are its contents valid (not corrupted) for the file type? ------------------------------------------------------------------------ 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=79263 -- Edit this bug report at https://bugs.php.net/bug.php?id=79263&edit=1

« previous php.bugs (#225582) next »