Issue #116 on hold

imagecreatefromstring() crashes PHP script

Anonymous created an issue

libgd crashes my PHP script on certain images using the imagecreatefromstring. This happens only on Linux and not on Windows. My GD and PHP details are below with an image and code to reproduce.

PHP Version 5.3.23 (and on 5.3.27) GD Support enabled GD Version bundled (2.0.34 compatible) FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.2.1 GIF Read Support enabled GIF Create Support enabled JPEG Support enabled libJPEG Version 6b PNG Support enabled libPNG Version 1.2.10 WBMP Support enabled XPM Support enabled libXpm Version 30411 XBM Support enabled

error_reporting(E_ALL ^ E_NOTICE);

if ($handle = opendir('./images/')) {
    while (false !== ($entry = readdir($handle))) {
        if ($entry != "." && $entry != "..") {
            getThumbnail('./images/' . $entry);

function getThumbnail($filename) {
    $sourceImage = @imagecreatefromstring(@file_get_contents($filename));

echo 'we made it';

Comments (2)

  1. Log in to comment