php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68250 Crash when finfo_buffer() used in object method
Submitted: 2014-10-17 12:08 UTC Modified: 2014-10-17 15:13 UTC
From: miloslav dot hula at gmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: master-Git-2014-10-17 (Git) OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: miloslav dot hula at gmail dot com
New email:
PHP Version: OS:

 

 [2014-10-17 12:08 UTC] miloslav dot hula at gmail dot com
Description:
------------
Testing on af3354dc43ae3c4bc6c9a9fb74aee2d9c2f406e3 (10.10.2014).

When calling finfo_buffer() from class method context, warning is emmited. It looks like the function is thinking that is finfo::buffer().

When I uncomment the first call in test below, I get SIGSEGV.

Test script:
---------------
// var_dump(finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), '<!DOCTYPE html>'));

class Test
{
    public function detect()
    {
        return finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), '<!DOCTYPE html>');
    }
}

var_dump(finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), '<!DOCTYPE html>'));
var_dump((new Test)->detect());


Expected result:
----------------
string(9) "text/html"
string(9) "text/html"


Actual result:
--------------
string(9) "text/html"

Warning: finfo_buffer() expects parameter 2 to be long, string given in /tmp/php7/finfo.php on line 7
bool(false)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-17 14:49 UTC] nikic@php.net
-Status: Open +Status: Feedback
 [2014-10-17 14:49 UTC] nikic@php.net
I've applied a fix in this direction just yesterday (https://github.com/php/php-src/commit/cf5920e8aa8958d47f391c483d7399fc77a58092), could you try a more recent build and confirm that the issue is resolved?
 [2014-10-17 15:13 UTC] miloslav dot hula at gmail dot com
-Status: Feedback +Status: Closed
 [2014-10-17 15:13 UTC] miloslav dot hula at gmail dot com
Yes, the commit fixed that. I'm sorry for duplicating. Closing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 08:01:28 2024 UTC