cvs: gd /libgd ISSUES gdft.c
[email protected] ("Pierre-Alain Joye")
| Newsgroups | php.gd.cvs |
|---|---|
| Message-ID | <cvspajoye1167859281@cvsserver> |
pajoye Wed Jan 3 21:21:21 2007 UTC
Modified files:
/gd/libgd gdft.c ISSUES
Log:
#30, uninitialized variable "charmap" and avoid divide-by-zero errors
at very small dpi values (John Ellson/Graphviz)
http://cvs.php.net/viewvc.cgi/gd/libgd/gdft.c?r1=1.27&r2=1.28&diff_format=u
Index: gd/libgd/gdft.c
diff -u gd/libgd/gdft.c:1.27 gd/libgd/gdft.c:1.28
--- gd/libgd/gdft.c:1.27 Wed Jan 3 21:04:00 2007
+++ gd/libgd/gdft.c Wed Jan 3 21:21:21 2007
@@ -1224,13 +1224,19 @@
/* make sure we have enough allocation for two numbers
so we don't have to recheck for the terminating number */
if (! xshow_alloc) {
- xshow_alloc = 100;
- strex->xshow = malloc(xshow_alloc);
- xshow_pos = 0;
+ xshow_alloc = 100;
+ strex->xshow = gdMalloc(xshow_alloc);
+ if (!strex->xshow) {
+ return 0;
+ }
+ xshow_pos = 0;
}
else if (xshow_pos + 20 > xshow_alloc) {
xshow_alloc += 100;
- strex->xshow = realloc(strex->xshow, xshow_alloc);
+ strex->xshow = gdRealloc(strex->xshow, xshow_alloc);
+ if (!strex->xshow) {
+ return 0;
+ }
}
xshow_pos += sprintf(strex->xshow + xshow_pos, "%g ",
(double)(penf.x - oldpenf.x) * hdpi / (64 * METRIC_RES));
@@ -1339,10 +1345,8 @@
if (brect)
{ /* only if need brect */
- double dpix, dpiy;
-
- dpix = 64 * METRIC_RES / hdpi;
- dpiy = 64 * METRIC_RES / vdpi;
+ double scalex = (double)hdpi / (64 * METRIC_RES);
+ double scaley = (double)vdpi / (64 * METRIC_RES);
/* increase by 1 pixel to allow for rounding */
total_min.x -= METRIC_RES;
@@ -1351,14 +1355,14 @@
total_max.y += METRIC_RES;
/* rotate bounding rectangle, scale and round to int pixels, and translate */
- brect[0] = x + (total_min.x * cos_a + total_max.y * sin_a)/dpix;
- brect[1] = y - (total_min.x * sin_a - total_max.y * cos_a)/dpiy;
- brect[2] = x + (total_max.x * cos_a + total_max.y * sin_a)/dpix;
- brect[3] = y - (total_max.x * sin_a - total_max.y * cos_a)/dpiy;
- brect[4] = x + (total_max.x * cos_a + total_min.y * sin_a)/dpix;
- brect[5] = y - (total_max.x * sin_a - total_min.y * cos_a)/dpiy;
- brect[6] = x + (total_min.x * cos_a + total_min.y * sin_a)/dpix;
- brect[7] = y - (total_min.x * sin_a - total_min.y * cos_a)/dpiy;
+ brect[0] = x + (total_min.x * cos_a + total_max.y * sin_a)*scalex;
+ brect[1] = y - (total_min.x * sin_a - total_max.y * cos_a)*scaley;
+ brect[2] = x + (total_max.x * cos_a + total_max.y * sin_a)*scalex;
+ brect[3] = y - (total_max.x * sin_a - total_max.y * cos_a)*scaley;
+ brect[4] = x + (total_max.x * cos_a + total_min.y * sin_a)*scalex;
+ brect[5] = y - (total_max.x * sin_a - total_min.y * cos_a)*scaley;
+ brect[6] = x + (total_min.x * cos_a + total_min.y * sin_a)*scalex;
+ brect[7] = y - (total_min.x * sin_a - total_min.y * cos_a)*scaley;
}
FT_Done_Size (platform_independent);
http://cvs.php.net/viewvc.cgi/gd/libgd/ISSUES?r1=1.25&r2=1.26&diff_format=u
Index: gd/libgd/ISSUES
diff -u gd/libgd/ISSUES:1.25 gd/libgd/ISSUES:1.26
--- gd/libgd/ISSUES:1.25 Wed Jan 3 21:04:00 2007
+++ gd/libgd/ISSUES Wed Jan 3 21:21:21 2007
@@ -54,3 +54,7 @@
tweenColorFetch
#28, Fixed gdImageStringFTEx when called with an empty string
Initialize the bounding box variables to zero (Kevin Scaldeferri)
+#29, Added sanity checks for allocations failure in gdImageStringFTEx
+ use gdMalloc and gdRealloc
+#30, uninitialized variable "charmap" and avoid divide-by-zero errors
+ at very small dpi values (John Ellson/Graphviz)