[poppler] Problem with your patch
Koji Otani
sho at bbr.jp
Tue Dec 25 02:23:17 PST 2007
Hi,
Very sorry, my patch has a bug again.
PDF file that is not embedding CID Font is displayed with garbage
characters.
Please apply new patch attached this mail.
new patch for git HEAD at Dec. 25.
In previous patch, It calls getEmbeddedFontName() to check if font is
embedded. But, this method allways return Non-NULL.
So, new patch make it call getEmbeddedID() instead.
----------
Koji Otani.
From: Koji Otani <sho at bbr.jp>
Subject: Re: [poppler] Problem with your patch
Date: Thu, 20 Dec 2007 14:36:55 +0900 (JST)
Message-ID: <20071220.143655.193697899.sho at bbr.jp>
sho> Hi
sho> I found 2 problems.
sho>
sho> (1) bad location of memory allocation code.
sho> and use null pointer.
sho> This causes crash.
sho>
sho> (2) But, getCodeToGIDMap function is called by the unexpected situation.
sho> In test PDF File (getticket.pdf), fonts are embedded and CIDToGIDMap
sho> entry is not contained. PDF specification sayes that if the TrueType font
sho> program is embedded, the Type 2 CIDFont dictionary must contain a
sho> CIDToGIDMap entry. (see PDF Reference, version 1.7 page 438).
sho> So, when a font is embedded, getCodeToGIDMap need not be called
sho> because cidToGID map is already set. but if CIDToGIDMap entry is
sho> 'identity' or not contained, getCodeToGIDMap is called and returnes
sho> incorrect cidToGID map.
sho>
sho> There has been problem(2) since poppler version 0.5.4 (before my
sho> patches were applied.)
sho>
sho> I attached patch resolves these problems.
sho>
sho> (1) moved the allocation code to correct location.
sho> (2) When a font is embedded, getCodeToGIDMap returnes cidToGID map
sho> is already set.
sho>
sho> This patch also removed unused variables.
sho>
sho> Please apply this patch.
sho>
sho> Thanks,
sho> ---------
sho> Koji Otani
sho>
sho> From: Albert Astals Cid <aacid at kde.org>
sho> Subject: Problem with your patch
sho> Date: Wed, 19 Dec 2007 21:18:16 +0100
sho> Message-ID: <200712192118.17083.aacid at kde.org>
sho>
sho> aacid> Hi Koji, when using poppler head with your latest patches, i get a crash in
sho> aacid> http://bugs.freedesktop.org/attachment.cgi?id=13226
sho> aacid>
sho> aacid> Could you please have a look?
sho> aacid>
sho> aacid> I'm attaching the gdb backtrace.
sho> aacid>
sho> aacid> Albert
-------------- next part --------------
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 1bab34e..79d5a26 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -1807,11 +1807,12 @@ Gushort *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) {
CMapListEntry *lp;
int cmap;
int cmapPlatform, cmapEncoding;
+ Ref embID;
*mapsizep = 0;
if (!ctu) return NULL;
if (getCollection()->cmp("Adobe-Identity") == 0) return NULL;
- if (getEmbeddedFontName() != NULL) {
+ if (getEmbeddedFontID(&embID)) {
/* if this font is embedded font,
* CIDToGIDMap should be embedded in PDF file
* and already set. So return it.
More information about the poppler
mailing list