- changed version to trunk
- changed component to libgd
-
assigned issue to
Pierre Joye
- changed status to open
Please look at the following piece of code:
{{{ #include<stdio.h> #include "gd.h"
int main() { / Declare the image / gdImagePtr im; / Declare output files / FILE *pngout; int black, white;
im = gdImageCreateTrueColor(63318, 771);
/ Allocate the color white (red, green and blue all maximum). /
white = gdImageColorAllocate(im, 255, 255, 255);
/ Allocate the color white (red, green and blue all maximum). /
black = gdImageColorAllocate(im, 0, 0, 0);
/ white background / gdImageFill(im, 1, 1, white);
gdImageSetAntiAliased(im, black);
/ This line fails! / gdImageLine(im, 28562, 631, 34266, 750, gdAntiAliased);
/ Open a file for writing. "wb" means "write binary", important under MSDOS, harmless under Unix. / pngout = fopen("test.png", "wb");
/ Output the image to the disk file in PNG format. / gdImagePng(im, pngout);
/ Close the files. / fclose(pngout);
/ Destroy the image in memory. / gdImageDestroy(im); } }}}
The function gdImageLine seems to never return, if at least one of the coordinates is over 32768 and anti-aliasing is used.
With coordinates different from the above example, the function may return, but the line drawn is still incorrect.
This problem was originally reported to gnuplot (bug no. 3377536), but I was able to isolate it.
gd version: 2.0.36 system: Ubuntu linux 10.04.2 32-bit
Péter Juhász
@Line 3716 src/gd.c
//infinite loop here not exiting from this loop 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); x += (1 << 16); y += inc; }