Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#1725 closed defect (fixed)

msDrawMarkerSymbolGD isn't initializing some variables causing gd to blow up

Reported by: hobu Owned by: sdlime
Priority: high Milestone:
Component: MapServer C Library Version: 4.8
Severity: critical Keywords:
Cc: jmckenna@…

Description

line 1763:
gdImageCopyResampled(img, symbol->img, offset_x, offset_y, 0, 0,
(int)(symbol->img->sx*d), (int)(symbol->img->sy*d), symbol->img->sx,
symbol->img->sy);

offset_x, offset_y, (int)(symbol->img->sx*d), and (int)(symbol->img->sy*d) 
aren't initialized.  This is the PIXMAP case.  This causes gd to go in an
infinite loop.

Exists in both 4.8.2 and CVS HEAD.  This is no good.

Change History (4)

comment:1 by hobu, 18 years ago

Norman suggested something like this:

     my_xs = MS_NINT(0.5*symbol->img->sx*d);
     my_ys = MS_NINT(0.5*symbol->img->sy*d);
     offset_x = p->x - my_xs +ox;
     offset_y = p->y - my_ys +oy;
     my_xs *=2;
     my_ys *=2;
     if ((offset_x+my_xs) > img->sx)
        my_xs -= 1;
     if ((offset_y+my_ys) > img->sy)
        my_ys -= 1;
     gdImageCopyResampled(img, symbol->img, offset_x, offset_y, 0,0, my_xs,
my_ys, symbol->img->sx, symbol->img->sy);

but he said we should really be checking to see if this symbol is being placed
off the image in the other dirction too

comment:2 by sdlime, 18 years ago

Status: newassigned
I think the problem may be that symbol->sizey/symbol->sizex are not being set
which are giving us some goofy-ass values for the scaling factor d and then
offset_x and offset_y in the marker drawing code. This was an issue with a
couple of other pieces of code recently (in fact was the problem I faced before
fishing). If this is the case then the change is in mapsymbol.c (should check
maplegend.c too since they are very similar in implementation). I'll check on it...

Steve 

comment:3 by sdlime, 18 years ago

Resolution: fixed
Status: assignedclosed
Fixed in CVS HEAD and the 4.8 branch...

Steve

comment:4 by jmckenna@…, 18 years ago

Cc: jmckenna@… added
Note: See TracTickets for help on using tickets.