Does PoDoFO crash without the patch? Just to know, because in pdfmm I have
no issues, but I **heavily** cleaned/bugfixed that code, and for example I
don't search backward the "trailer" token anymore, which is fishy and I
believe is the source of your issues. Unfortunately not doing that is not a
oneliner[1][2].

[1]
https://github.com/pdfmm/pdfmm/commit/98e8e8c207db8f57bbf1423c1ebd7c722228292a
[2]
https://github.com/pdfmm/pdfmm/commit/f771490b01a5d86c87891494c9b3adc5ed7e95fb

On Tue, 26 Apr 2022 at 17:42, Dennis Voss <dennis.v...@dots.de> wrote:

> Hey,
>
> attached is a pdf-file that is failing to be parsed by PoDoFo and a patch
> for that bug.
>
> Description:
>
> The pdf-file has comments between the EOF and the 'trailer' token. These
> comments are 'longer' than the lRange (lookup range) provided to findToken,
> so when we try to find the 'trailer' token we will end up somewhere in the
> comments and fail to find the token.
>
> Therefore,  if the token we are looking for is equal to 'trailer' we
> resize the buffer accordingly (nFileSize - m_nXRefOffset), this should
> always find the 'trailer' token.
>
>
> I dont know about the findToken2 function. The same code can be copied
> over to there, but* i didn't patch *findToken2. That function seems to be
> a bandaid for some other issue already, so i dont want to mess with it...
> (feel free to patch it too though, i think it has the same problem).
>
>
> Best Regards,
>
> Dennis Voss
>
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to