Description:
------------
When run on certain files (chiefly text files and in this specific instance, CSV files), the Fileinfo extension immediately tries to allocate a huge amount of memory (multiple gigabytes) and exceeds the limit.
This behavior on a sample file was confirmed on multiple PHP versions across different distributions, including PHP 5.4.36 on CentOS (with "file" version 5.04) and PHP 5.6.6 on Gentoo (with "file" version 5.22).
The file "test.csv" that causes this behavior is available at http://zerocrates.org/test.csv
Test script:
---------------
$finfo = finfo_open(FILEINFO_MIME_TYPE);
echo finfo_file($finfo, 'test.csv');
OR
$finfo = new finfo(FILEINFO_MIME_TYPE);
echo $finfo->file('test.csv');
Expected result:
----------------
The output should simply be "text/plain"
Running the command-line tool "file -bi" on the sample file gives a correct output more or less immediately: "text/plain; charset=us-ascii"
Actual result:
--------------
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 4294955358 bytes)
Note the amount of bytes for the attempted allocation, 4 gigabytes.

@nmenciere I cannot reproduce it with the current 5.6 dev tree with the reproduce case linked here. If you think this or similar bug is present, please open a new ticket and post your reproduce case.
Thanks.