summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2011-08-12 19:50:13 +0200
committerWerner Lemberg <wl@gnu.org>2011-08-12 19:50:13 +0200
commitbad0160c1612ac48c94f490ac33318ccccb535e4 (patch)
tree6fe4b6522532afc4423274c2e0475e899a30e8e8
parentb91e78530803fbc5e73b56f0280823e09deadc72 (diff)
downloadfreetype2-bad0160c1612ac48c94f490ac33318ccccb535e4.tar.gz
[truetype] Fix degenerate case in S{P,F,DP}VTL opcodes.
* src/truetype/ttinterp.c (Ins_SxVTL): Handle p1 == p2 specially. (Ins_SDPVTL): Handle v1 == v2 specially.
-rw-r--r--ChangeLog7
-rw-r--r--src/truetype/ttinterp.c29
2 files changed, 33 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index d01132ea3..cd63208ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-08-12 Werner Lemberg <wl@gnu.org
+
+ [truetype] Fix degenerate case in S{P,F,DP}VTL opcodes.
+
+ * src/truetype/ttinterp.c (Ins_SxVTL): Handle p1 == p2 specially.
+ (Ins_SDPVTL): Handle v1 == v2 specially.
+
2011-08-09 Werner Lemberg <wl@gnu.org>
Fix Savannah bug #33975.
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index b29aa0e1d..6c4eed684 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -2845,6 +2845,17 @@
A = p1->x - p2->x;
B = p1->y - p2->y;
+ /* If p1 == p2, SPVTL and SFVTL behave the same as */
+ /* SPVTCA[X] and SFVTCA[X], respectively. */
+ /* */
+ /* Confirmed by Greg Hitchcock. */
+
+ if ( A == 0 && B == 0 )
+ {
+ A = 0x4000;
+ aOpc = 0;
+ }
+
if ( ( aOpc & 1 ) != 0 )
{
C = B; /* counter clockwise rotation */
@@ -5181,7 +5192,8 @@
Ins_SDPVTL( INS_ARG )
{
FT_Long A, B, C;
- FT_UShort p1, p2; /* was FT_Int in pas type ERROR */
+ FT_UShort p1, p2; /* was FT_Int in pas type ERROR */
+ FT_Int aOpc = CUR.opcode;
p1 = (FT_UShort)args[1];
@@ -5202,9 +5214,20 @@
A = v1->x - v2->x;
B = v1->y - v2->y;
+
+ /* If v1 == v2, SDPVTL behaves the same as */
+ /* SVTCA[X], respectively. */
+ /* */
+ /* Confirmed by Greg Hitchcock. */
+
+ if ( A == 0 && B == 0 )
+ {
+ A = 0x4000;
+ aOpc = 0;
+ }
}
- if ( ( CUR.opcode & 1 ) != 0 )
+ if ( ( aOpc & 1 ) != 0 )
{
C = B; /* counter clockwise rotation */
B = A;
@@ -5222,7 +5245,7 @@
B = v1->y - v2->y;
}
- if ( ( CUR.opcode & 1 ) != 0 )
+ if ( ( aOpc & 1 ) != 0 )
{
C = B; /* counter clockwise rotation */
B = A;