Hi

Here’s a patch for a heap corruption issue experienced when reading some 
damaged PDF documents:

/src/base/PdfXRefStreamParserObject.cpp

Line 137-142 was
//printf("nCount=%i ", static_cast<int>(nCount));
//printf("pBuffer=%li ", (long)(pBuffer - pStart));
//printf("pEnd=%li ", lBufferLen);
if( ! (*m_pOffsets)[static_cast<int>(nFirstObj)].bParsed )
ReadXRefStreamEntry( pBuffer, lBufferLen, nW, static_cast<int>(nFirstObj) );

Additional line added to make sure nFirstObj is in range:

//printf("nCount=%i ", static_cast<int>(nCount));
//printf("pBuffer=%li ", (long)(pBuffer - pStart));
//printf("pEnd=%li ", lBufferLen);
if ( nFirstObj >= 0 && nFirstObj < m_pOffsets->size() )
                                if( ! 
(*m_pOffsets)[static_cast<int>(nFirstObj)].bParsed )
ReadXRefStreamEntry( pBuffer, lBufferLen, nW, static_cast<int>(nFirstObj) );

Best Regards
Mark

Mark Rogers - mark.rog...@powermapper.com
PowerMapper Software Ltd - www.powermapper.com
Registered in Scotland No 362274 Quartermile 2 Edinburgh EH3 9GL

From: cybevnm [mailto:cybe...@gmail.com]
Sent: 19 February 2013 18:45
To: Leonard Rosenthol; podofo-users@lists.sourceforge.net
Subject: Re: [Podofo-users] CID fonts subsettting

There is a broblem - I'm not sure how to do font subsetting for unicode-aware 
TTF font using PoDoFo API.
Seems like there are no way to ask for TTF font with subsetting enabled using 
casual PdfDocument.CreateFont(). 
EFontCreationFlags::eFontCreationFlags_Type1Subsetting isn't about TTF; 
PdfDocument.CreateFontSubset just pulls every glyph to subset (i.e. makes usual 
embedding).
So, how can I force PoDoFo to create TTF font with subsetting enabled ? (or I 
just moving in wrong direction?)


2/19/2013 2:12 AM, Leonard Rosenthol пишет:
If you are planning to support a wide set of potential languages with a single 
font, then yes, subset embedding is the correct solution.

IIRC, PoDoFo supports subsetting for TrueType fonts only.  If that font is a 
TTF, you should be fine.

Leonard

From: cybevnm <cybe...@gmail.com<mailto:cybe...@gmail.com>>
Date: Monday, February 18, 2013 5:09 PM
To: Leonard Rosenthol <lrose...@adobe.com<mailto:lrose...@adobe.com>>
Cc: 
"podofo-users@lists.sourceforge.net<mailto:podofo-users@lists.sourceforge.net>" 
<podofo-users@lists.sourceforge.net<mailto:podofo-users@lists.sourceforge.net>>
Subject: Re: [Podofo-users] CID fonts subsettting

I want to generate a pdf document, which contains strings in several languages. 
Set of the languages (i.e. set of required characters) can be determined only 
at generation phase, so I've decided to use a font, which contains as much as 
possible characters (http://en.wikipedia.org/wiki/GNU_Unifont in my case), to 
represent any possible input language during the rendering of the document by a 
pdf viewer.
The GNU Unifont isn't common at clients' workstations (which is mostly under 
the MS Windows control), so I should to do some form of font embedding. But I 
have conflicting requirement - documents should be as small as possible, so 
full font embedding isn't an option (+ 3 Mbytes of overhead per document is too 
much for me).
I think that only possible option in my situation is to embed only those glyphs 
which actually used in document - this is what I mean under 'font subsetting' 
term.
Is it possible to make this using PoDoFo ? Or maybe there are another ways to 
satisfy the requirements ?


On 02/18/2013 11:22 PM, Leonard Rosenthol wrote:

You don't actually subset a CID font - since there is no such thing as a

CID font file.



A CID font is really a special way to encode/store font data in a PDF file

when having to deal with Unicode-based fonts.  You can create a CID font

from a TTF or OTF font as part of subsetting it - though it's not required.



So backing this upŠ



What are you trying to achieve with PoDoFo that is blocking you?



Leonard





On 2/18/13 2:42 PM, "cybevnm" <cybe...@gmail.com><mailto:cybe...@gmail.com> 
wrote:



Hi!

After some searching through the podofo code I suspect that subsetting

for the CID fonts isn't implemented (PdfFontCID doesn't implement

AddUsedSubsettingGlyphs etc.) and can be done just for the PdfFontType1

fonts (which doesn't support unicode).  But there are mystic (for me)

PdfFontTTFSubset and PdfFontCache::GetFontSubset.

So, is CID fonts (unicode-aware) subsetting supported and what are

PdfFontTTFSubset and PdfFontCache::GetFontSubset  for ?

Thanks!





--------------------------------------------------------------------------

----

The Go Parallel Website, sponsored by Intel - in partnership with

Geeknet,

is your hub for all things parallel software development, from weekly

thought

leadership blogs to news, videos, case studies, tutorials, tech docs,

whitepapers, evaluation guides, and opinion stories. Check out the most

recent posts - join the conversation now.

http://goparallel.sourceforge.net/

_______________________________________________

Podofo-users mailing list

Podofo-users@lists.sourceforge.net<mailto:Podofo-users@lists.sourceforge.net>https://lists.sourceforge.net/lists/listinfo/podofo-users


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to