Bug #69706 [NEW]: getimagesize() can fail if the underlying stream doensn't support seeking

From: Date: Mon, 25 May 2015 18:29:11 +0000
Subject: Bug #69706 [NEW]: getimagesize() can fail if the underlying stream doensn't support seeking
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192884@lists.php.net to get a copy of this message
From: deviantintegral at gmail dot com Operating system: Any PHP version: 5.6.9 Package: GetImageSize related Bug Type: Bug Bug description:getimagesize() can fail if the underlying stream doensn't support seeking Description: ------------ I've verified this is an issue on PHP 5.4, 5.6, and statically on the master branch. The AWS SDK (https://aws.amazon.com/sdk-for-php/) includes a stream wrapper that by default does not support seeking on files backed by S3. Calling getimagesize() on an image can fail if php_skip_variable() is called. I've seen this happen with images that specify the "Image Quality" EXIF tag, which is the M_APP15 constant in ext/standard/image.c. The stream documentation states that seeking is not required to be supported by stream wrappers, and it's not clear that getimagesize() needs seeking to work properly. I see two ways to improve this: * Log a notice if php_skip_variable() tries to seek on an unseekable stream. That would have saved me a ton of time tracing this with GDB. * Or, if a stream is not seekable, copy the file to the temporary file system and fetch metadata from there. -- Edit bug report at https://bugs.php.net/bug.php?id=69706&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69706&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69706&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69706&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69706&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69706&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69706&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69706&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69706&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69706&r=support Expected behavior: https://bugs.php.net/fix.php?id=69706&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69706&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69706&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69706&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69706&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69706&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69706&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69706&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69706&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69706&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69706&r=mysqlcfg

« previous php.bugs (#192884) next »