derick Sun Apr 25 15:45:04 2004 EDT Modified files: /php-src/ext/gd/tests bug28147.phpt /php-src/ext/gd/libgd gd.c Log: - MFB: Fixed bug #28147 (Crash with drawing anti-alised lines) http://cvs.php.net/diff.php/php-src/ext/gd/tests/bug28147.phpt?r1=1.1&r2=1.2&ty=u Index: php-src/ext/gd/tests/bug28147.phpt diff -u /dev/null php-src/ext/gd/tests/bug28147.phpt:1.2 --- /dev/null Sun Apr 25 15:45:02 2004 +++ php-src/ext/gd/tests/bug28147.phpt Sun Apr 25 15:45:02 2004 @@ -0,0 +1,27 @@ +--TEST-- +Bug #28147 (Crash with anti-aliased line) +--SKIPIF-- +<?php + if (!extension_loaded('gd')) die("skip gd extension not available\n"); + if (!GD_BUNDLED) die('skip external GD libraries always fail'); +?> +--FILE-- +<?php +// +// This script will generate a Seg Fault on Linux +// +$im = imagecreatetruecolor(300, 300); +$w = imagecolorallocate($im, 255, 255, 255); +$red = imagecolorallocate($im, 255, 0, 0); + +imagefilledrectangle($im,0,0,299,299,$w); + +imageantialias($im,true); +imageline($im, 299, 299, 0, 299, $red); + +imagedestroy($im); + +echo "Alive\n"; +?> +--EXPECT-- +Alive http://cvs.php.net/diff.php/php-src/ext/gd/libgd/gd.c?r1=1.77&r2=1.78&ty=u Index: php-src/ext/gd/libgd/gd.c diff -u php-src/ext/gd/libgd/gd.c:1.77 php-src/ext/gd/libgd/gd.c:1.78 --- php-src/ext/gd/libgd/gd.c:1.77 Mon Mar 29 13:20:33 2004 +++ php-src/ext/gd/libgd/gd.c Sun Apr 25 15:45:02 2004 @@ -1288,7 +1288,9 @@ inc = (dy * 65536) / dx; while ((x >> 16) < x2) { gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (y >> 8) & 0xFF); - gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF); + if ((y >> 16) + 1 < im->sy) { + gdImageSetAAPixelColor(im, x >> 16, (y >> 16) + 1,col, (~y >> 8) & 0xFF); + } x += (1 << 16); y += inc; } @@ -1308,7 +1310,9 @@ inc = (dx * 65536) / dy; while ((y>>16) < y2) { gdImageSetAAPixelColor(im, x >> 16, y >> 16, col, (x >> 8) & 0xFF); - gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF); + if ((x >> 16) + 1 < im->sx) { + gdImageSetAAPixelColor(im, (x >> 16) + 1, (y >> 16),col, (~x >> 8) & 0xFF); + } x += inc; y += (1<<16); }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php