-
behavior: segmentation fault
-
description: draw anti-alised line on a palette image resource
-
sketch:
-
php_gd_gdImageCreate
at ext/gd/libgd/gd.c:213im->tpixels = 0;
line 2
$im=imagecreate(100,100);
inpoc.php
is to create a new palette based image that doesn't support truecolor. -
php_gd_gdImageSetAntiAliased
at ext/gd/libgd/gd.c:2826im->AA = 1;
line 3
imageantialias($im,true);
activate the fast drawing antialiased methods for lines and wired polygons, which is a feature that works only with truecolor images. -
zif_imageline
at ext/gd/gd.c:3191if (im->AA) { gdImageSetAntiAliased(im, col); col = gdAntiAliased; } gdImageLine(im, x1, y1, x2, y2, col);
-
php_gd_gdImageLine
at ext/gd/libgd/gd.c:1053if (color == gdAntiAliased) { /* gdAntiAliased passed as color: use the much faster, much cheaper and equally attractive gdImageAALine implementation. That clips too, so don't clip twice. */ gdImageAALine(im, x1, y1, x2, y2, im->AA_color); return; }
-
php_gd_gdImageAALine
at ext/gd/libgd/gd.c:1270gdImageSetAAPixelColor(im, x, y + 1, col, (~frac >> 8) & 0xFF);
Set truecolor for antialised line pixel by pixel.
-
gdImageSetAAPixelColor
at ext/gd/libgd/gd.c:1230im->tpixels[y][x]=gdTrueColorAlpha(dr, dg, db, gdAlphaOpaque);
However,
$im
is a palette based image, which means it doesn't have truecolor pixels. Recalim->tpixels = 0
, segmentation fault.
-
-
-
-
-
patch: check if the image is of true color before draw anti-alised lines
php-76041
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||