summaryrefslogtreecommitdiff
path: root/fofi
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2011-09-01 18:27:51 +0200
committerCarlos Garcia Campos <carlosgc@gnome.org>2011-09-01 18:27:51 +0200
commit1369862ed61ef8b0f81c52fce36f6c1602d82ddb (patch)
treeee2afb7b84c3f43e42d6bfe987d095f57457f57a /fofi
parent0fe7cc82e84dc2a3b79248b111656e5e7df9fdc2 (diff)
xpdf303: Ignore entries that have an invalid tag too
Diffstat (limited to 'fofi')
-rw-r--r--fofi/FoFiTrueType.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index f131fac4..c132da18 100644
--- a/fofi/FoFiTrueType.cc
+++ b/fofi/FoFiTrueType.cc
@@ -1249,10 +1249,14 @@ void FoFiTrueType::writeTTF(FoFiOutputFunc outputFunc,
newTables = (TrueTypeTable *)gmallocn(nNewTables, sizeof(TrueTypeTable));
j = 0;
for (i = 0; i < nTables; ++i) {
- if (tables[i].len > 0) {
+ if (tables[i].len > 0 &&
+ (tables[i].tag & 0xe0000000) &&
+ (tables[i].tag & 0x00e00000) &&
+ (tables[i].tag & 0x0000e000) &&
+ (tables[i].tag & 0x000000e0)) {
newTables[j] = tables[i];
newTables[j].origOffset = tables[i].offset;
- if (checkRegion(tables[i].offset, newTables[i].len)) {
+ if (checkRegion(tables[i].offset, tables[i].len)) {
newTables[j].checksum =
computeTableChecksum(file + tables[i].offset, tables[i].len);
if (tables[i].tag == headTag) {