php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74910 getimagesize on SWC files returns zero width and height
Submitted: 2017-07-12 12:16 UTC Modified: 2017-08-20 04:22 UTC
From: adam dot rosadzinski at home dot net dot pl Assigned: cmb (profile)
Status: No Feedback Package: GetImageSize related
PHP Version: Irrelevant OS: Arch Linux
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:
MUST BE VALID
Solve the problem:
9 + 1 = ?
Subscribe to this entry?

 
 [2017-07-12 12:16 UTC] adam dot rosadzinski at home dot net dot pl
Description:
------------
Since zlib 1.2.9 has been released, changes in uncompress function exposed problem in php_handle_swc function from ext/standard/image.c

Before 1.2.9, uncompress didn't touch destBytes value on failure. As of 1.2.9 it will be set to 0.

No data will be copied if first uncompress call fails, as len value will be changed to 0 and then used to copy uncompressed data from temporary buffer.

Verified on PHP: 5.2, 5.3, 5.4, 5.5, 5.6, 7.0, 7.1


Patches

swc-len-fix-php7.0 (last revision 2017-07-12 12:54 UTC by adam dot rosadzinski at home dot net dot pl)
swc-len-fix (last revision 2017-07-12 12:17 UTC by adam dot rosadzinski at home dot net dot pl)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-12 12:55 UTC] adam dot rosadzinski at home dot net dot pl
Submitted patch was prepared for PHP 7.0
 [2017-08-11 06:27 UTC] kalle@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: cmb
 [2017-08-11 06:27 UTC] kalle@php.net
@christoph, since you recently have been fiddling around with the getimagesizes() stuff and gd, could you verify this?
 [2017-08-11 06:28 UTC] kalle@php.net
-Package: Zlib related +Package: GetImageSize related
 [2017-08-11 09:38 UTC] cmb@php.net
I have no experience with SWC (or SWF for that matter), but the
code in php_handle_swc() looks fishy. The patch, however, does not
look good either, because it would pass 0 as destLen argument to
uncompress() while destLen is supposed to be the length of the
destination buffer on function entry.

Anyway, I think we need a few small SWC sample files for testing.
Adam, can you provide these?
 [2017-08-11 09:39 UTC] cmb@php.net
-Status: Assigned +Status: Feedback
 [2017-08-20 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 08:01:29 2024 UTC