Hi

There are underflow conditions in PdfString::GetLength() and 
PdfString::GetUnicodeLength - these return lengths of -2 and -1 if 
m_buffer.GetSize is zero. That has a knock on effect of mallocing (size_t)-1 or 
(size_t)-2 in various ConvertToEncoding methods (4GB-2 when size_t is 32-bit) 
which will usually fail and throw an ePdfError_OutOfMemory error.

Is the behaviour in PdfString intentional or should it be patched as below?


pdf_long PdfString::GetLength() const
{
// patch? if ( m_buffer.GetSize() == 0 ) return 0;

    return m_buffer.GetSize() - 2;
}

pdf_long PdfString::GetCharacterLength() const
{
    return this->IsUnicode() ? this->GetUnicodeLength() : this->GetLength();
}

pdf_long PdfString::GetUnicodeLength() const
{
// patch? if ( m_buffer.GetSize() == 0 ) return 0;

    return (m_buffer.GetSize() / sizeof(pdf_utf16be)) - 1;
}


Best Regards
Mark


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

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to