summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2010-07-12 15:47:54 +0000
committerTaco Hoekwater <taco@elvenkind.com>2010-07-12 15:47:54 +0000
commitba61313bb43691c8ab8941620c277db1256a9d8f (patch)
treedfc2814e700bac7d7c43d4fc7d22d77455106545 /Build
parent9190d67136c178534becf29dac3ff628cc024120 (diff)
luatex: fix for a crash related to bad panose data
git-svn-id: svn://tug.org/texlive/trunk@19399 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/luatexdir/ChangeLog6
-rw-r--r--Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c36
-rw-r--r--Build/source/texk/web2c/luatexdir/luatex_svnversion.h2
3 files changed, 31 insertions, 13 deletions
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog
index 29dbbad2d01..1e7be9897c1 100644
--- a/Build/source/texk/web2c/luatexdir/ChangeLog
+++ b/Build/source/texk/web2c/luatexdir/ChangeLog
@@ -1,3 +1,9 @@
+2010-07-12 Taco Hoekwater <taco@luatex.org>
+
+ * luafontloader/src/luafflib.c: quick fix for crashes triggered
+ by invalid panose data in Open/TrueType fonts.
+ * luatex_svnversion.h: new version (rev 3736).
+
2010-07-01 Taco Hoekwater <taco@luatex.org>
* lang/texlang.w, lua/lnodelib.c, luatex.c, luatex_svnversion.h,
diff --git a/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c b/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c
index 8b7d2bd9415..726fb0d5659 100644
--- a/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c
+++ b/Build/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c
@@ -32,8 +32,8 @@
#include "ustring.h"
static const char _svn_version[] =
- "$Id: luafflib.c 3456 2010-03-07 09:12:36Z taco $ "
- "$URL: http://foundry.supelec.fr/svn/luatex/tags/beta-0.60.0/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c $";
+ "$Id: luafflib.c 3736 2010-07-12 15:42:56Z taco $ "
+ "$URL: http://foundry.supelec.fr/svn/luatex/branches/0.60.x/source/texk/web2c/luatexdir/luafontloader/src/luafflib.c $";
extern char **gww_errors;
extern int gww_error_count;
@@ -1114,6 +1114,18 @@ char *panose_values_9[] =
"Constant/Large", "Ducking/Small", "Ducking/Standard", "Ducking/Large"
};
+#define panose_values_0_max 5
+#define panose_values_1_max 15
+#define panose_values_2_max 11
+#define panose_values_3_max 9
+#define panose_values_4_max 9
+#define panose_values_5_max 8
+#define panose_values_6_max 11
+#define panose_values_7_max 15
+#define panose_values_8_max 13
+#define panose_values_9_max 7
+
+#define fix_range(a,b) (b<0 ? 0 : (b>a ? 0 : b))
void handle_pfminfo(lua_State * L, struct pfminfo pfm)
{
@@ -1136,16 +1148,16 @@ void handle_pfminfo(lua_State * L, struct pfminfo pfm)
dump_intfield(L, "firstchar", pfm.firstchar);
dump_intfield(L, "lastchar", pfm.lastchar);
lua_createtable(L, 0, 10);
- dump_enumfield(L, "familytype", pfm.panose[0], panose_values_0);
- dump_enumfield(L, "serifstyle", pfm.panose[1], panose_values_1);
- dump_enumfield(L, "weight", pfm.panose[2], panose_values_2);
- dump_enumfield(L, "proportion", pfm.panose[3], panose_values_3);
- dump_enumfield(L, "contrast", pfm.panose[4], panose_values_4);
- dump_enumfield(L, "strokevariation", pfm.panose[5], panose_values_5);
- dump_enumfield(L, "armstyle", pfm.panose[6], panose_values_6);
- dump_enumfield(L, "letterform", pfm.panose[7], panose_values_7);
- dump_enumfield(L, "midline", pfm.panose[8], panose_values_8);
- dump_enumfield(L, "xheight", pfm.panose[9], panose_values_9);
+ dump_enumfield(L, "familytype", fix_range(panose_values_0_max, pfm.panose[0]), panose_values_0);
+ dump_enumfield(L, "serifstyle", fix_range(panose_values_1_max, pfm.panose[1]), panose_values_1);
+ dump_enumfield(L, "weight", fix_range(panose_values_2_max, pfm.panose[2]), panose_values_2);
+ dump_enumfield(L, "proportion", fix_range(panose_values_3_max, pfm.panose[3]), panose_values_3);
+ dump_enumfield(L, "contrast", fix_range(panose_values_4_max, pfm.panose[4]), panose_values_4);
+ dump_enumfield(L, "strokevariation", fix_range(panose_values_5_max, pfm.panose[5]), panose_values_5);
+ dump_enumfield(L, "armstyle", fix_range(panose_values_6_max, pfm.panose[6]), panose_values_6);
+ dump_enumfield(L, "letterform", fix_range(panose_values_7_max, pfm.panose[7]), panose_values_7);
+ dump_enumfield(L, "midline", fix_range(panose_values_8_max, pfm.panose[8]), panose_values_8);
+ dump_enumfield(L, "xheight", fix_range(panose_values_9_max, pfm.panose[9]), panose_values_9);
lua_setfield(L, -2, "panose");
dump_intfield(L, "fstype", pfm.fstype);
diff --git a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
index 8d3e097ba0d..1a9f3e62096 100644
--- a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
+++ b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
@@ -1 +1 @@
-#define luatex_svn_revision 3730
+#define luatex_svn_revision 3736