Bug 167843

Summary: gd may crash whan drawing antialiased line near image borders
Product: [Fedora] Fedora Reporter: Nikita Shulga <malfet>
Component: gdAssignee: Phil Knirsch <pknirsch>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4CC: rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-10-10 13:57:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Following patch will fix the problem mentioned none

Description Nikita Shulga 2005-09-08 20:17:10 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; ru-ru) AppleWebKit/412.7 (KHTML, like Gecko) Safari/412.5

Description of problem:
If one will try to draw antialiased line parallel to horizontal or vertical border - GD will try to put pixel 
outside of picture limits, which in majority of cases will lead to segfault.

Version-Release number of selected component (if applicable):
gd-2.0.33-2

How reproducible:
Always

Steps to Reproduce:
1. Compile following program:
#include <gd.h>
int main(void) {
        gdImage *img = gdImageCreateTrueColor(640,480);
        gdImageAlphaBlending(img, 1);
        gdImageSetAntiAliased(img, 1); 
        gdImageLine(img, 202, 479, 198, 479, -7);
}

2. Run it
  

Actual Results:  segfault

Expected Results:  no segfault

Additional info:

Comment 1 Nikita Shulga 2005-09-08 20:19:35 UTC
Created attachment 118608 [details]
Following patch will fix the problem mentioned

At the very begining of gdImageSetAAPixel color function checks that action are
performed within picture limits

Comment 2 Phil Knirsch 2005-10-10 13:57:27 UTC
Looks good, will be included in next gd build for development.

Read ya, Phil