ref: d45d4b97e6a03cfe21a2952138cf6e970fc358e5
parent: a3cfed5e87232c933bdc64f43e8ebebcfd18b41b
author: Armin Hasitzka <[email protected]>
date: Wed May 30 13:35:39 EDT 2018
Beautify a3cfed5e87232c933bdc64f43e8ebebcfd18b41b. * src/autofit/afloader.c (af_loader_load_glyph): Move the initialisation and declaration of variables into the if-block.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2018-05-30 Armin Hasitzka <[email protected]>
+ Beautify a3cfed5e87232c933bdc64f43e8ebebcfd18b41b.
+
+ * src/autofit/afloader.c (af_loader_load_glyph): Move the
+ initialisationand declaration of variables into the if-block.
+
+2018-05-30 Armin Hasitzka <[email protected]>
+
Fix pointer underflow.
The declaration of `edge2' can be reached with `edge1 == NULL' and
--- a/src/autofit/afloader.c
+++ b/src/autofit/afloader.c
@@ -430,27 +430,25 @@
/* width/positioning that occurred during the hinting process */
if ( scaler.render_mode != FT_RENDER_MODE_LIGHT )
{
- FT_Pos old_rsb, old_lsb, new_lsb;
- FT_Pos pp1x_uh, pp2x_uh;
-
AF_AxisHints axis = &hints->axis[AF_DIMENSION_HORZ];
- AF_Edge edge1 = axis->edges; /* leftmost edge */
- AF_Edge edge2; /* rightmost edge */
if ( axis->num_edges > 1 && AF_HINTS_DO_ADVANCE( hints ) )
{
- edge2 = edge1 + axis->num_edges - 1;
+ AF_Edge edge1 = axis->edges; /* leftmost edge */
+ AF_Edge edge2 = edge1 +
+ axis->num_edges - 1; /* rightmost edge */
- old_rsb = loader->pp2.x - edge2->opos;
+ FT_Pos old_rsb = loader->pp2.x - edge2->opos;
/* loader->pp1.x is always zero at this point of time */
- old_lsb = edge1->opos /* - loader->pp1.x */;
- new_lsb = edge1->pos;
+ FT_Pos old_lsb = edge1->opos; /* - loader->pp1.x */
+ FT_Pos new_lsb = edge1->pos;
/* remember unhinted values to later account */
/* for rounding errors */
- pp1x_uh = new_lsb - old_lsb;
- pp2x_uh = edge2->pos + old_rsb;
+ FT_Pos pp1x_uh = new_lsb - old_lsb;
+ FT_Pos pp2x_uh = edge2->pos + old_rsb;
+
/* prefer too much space over too little space */
/* for very small sizes */