|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42500 memcmp does not check full array
Submitted: 2007-08-31 16:04 UTC Modified: 2007-09-11 01:00 UTC
From: doppelbauer at gmx dot net Assigned:
Status: No Feedback Package: GetImageSize related
PHP Version: 5.2.4 OS: any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
48 + 38 = ?
Subscribe to this entry?

 [2007-08-31 16:04 UTC] doppelbauer at gmx dot net
Don't know, if this is a bug in the "getimagesize()" function.

The "php_getimagetype()" compares just 3 bytes of the 4-byte array.
Source code: /ext/standard/image.c

PHPAPI int php_getimagetype(php_stream * stream, char *filetype TSRMLS_DC)
    PHPAPI const char php_sig_psd[4] = {'8', 'B', 'P', 'S'};
    } else if (!memcmp(filetype, php_sig_psd, 3)) {


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-03 09:13 UTC]
And the reproducing PHP script + image can be found where?
 [2007-09-11 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jul 23 17:01:23 2021 UTC