[truetype] Fix Savannah bug #38211. * src/truetype/ttinterp.c (Ins_IP): Make FreeType behave identical to other interpreters if rp1 == rp2 (which is invalid).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
diff --git a/ChangeLog b/ChangeLog
index aa5d62c..466129b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-02-01 Werner Lemberg <wl@gnu.org>
+
+ [truetype] Fix Savannah bug #38211.
+
+ * src/truetype/ttinterp.c (Ins_IP): Make FreeType behave identical
+ to other interpreters if rp1 == rp2 (which is invalid).
+
2013-01-28 Alexei Podtelezhnikov <apodtele@gmail.com>
[base] Small optimization of BBox calculation.
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index d1fd805..4e4a5bf 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -6974,9 +6974,18 @@
cur_dist = CUR_Func_project ( &CUR.zp2.cur[point], cur_base );
if ( org_dist )
- new_dist = ( old_range != 0 )
- ? FT_MulDiv( org_dist, cur_range, old_range )
- : cur_dist;
+ {
+ if ( old_range )
+ new_dist = FT_MulDiv( org_dist, cur_range, old_range );
+ else
+ {
+ /* use the middle position */
+ new_dist = cur_dist -
+ CUR_fast_dualproj( &CUR.zp2.cur[point] ) +
+ ( CUR_fast_dualproj( &CUR.zp1.cur[CUR.GS.rp1] ) +
+ CUR_fast_dualproj( &CUR.zp1.cur[CUR.GS.rp2] ) ) / 2;
+ }
+ }
else
new_dist = 0;