[poppler] Branch 'poppler-0.6' - fofi/FoFiTrueType.cc
Carlos Garcia Campos
carlosgc at kemper.freedesktop.org
Mon Oct 22 02:31:26 PDT 2007
fofi/FoFiTrueType.cc | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
New commits:
commit e30d2d2b70e3aaa52af65fb26ac0b5079f96ee50
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Mon Oct 22 11:25:37 2007 +0200
Fix a crash with invalid TrueType fonts
diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index abfca73..77a7ad2 100644
--- a/fofi/FoFiTrueType.cc
+++ b/fofi/FoFiTrueType.cc
@@ -912,10 +912,12 @@ void FoFiTrueType::writeTTF(FoFiOutputFunc outputFunc,
badCmapLen = gFalse;
cmapLen = 0; // make gcc happy
if (!missingCmap) {
- cmapLen = cmaps[0].offset + cmaps[0].len;
- for (i = 1; i < nCmaps; ++i) {
- if (cmaps[i].offset + cmaps[i].len > cmapLen) {
- cmapLen = cmaps[i].offset + cmaps[i].len;
+ if (nCmaps > 0) {
+ cmapLen = cmaps[0].offset + cmaps[0].len;
+ for (i = 1; i < nCmaps; ++i) {
+ if (cmaps[i].offset + cmaps[i].len > cmapLen) {
+ cmapLen = cmaps[i].offset + cmaps[i].len;
+ }
}
}
cmapLen -= tables[cmapIdx].offset;
More information about the poppler
mailing list