[ 
https://issues.apache.org/jira/browse/PDFBOX-5401?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17513171#comment-17513171
 ] 

Andreas Lehmkühler edited comment on PDFBOX-5401 at 3/28/22, 3:16 PM:
----------------------------------------------------------------------

I've followed [~tilman] proposal and added the expected prev position to the 
set as well.

Now the loop protection works as expected and the infinite loop vanished

[~Han0nly] thanks for reporting this


was (Author: lehmi):
I've followed [~tilman] proposal add added the expected prev position to the 
set as well.

Now the loop protection works as expected and the infinite loop vanished

[~Han0nly] thanks for reporting this

> A carefully crafted pdf can trigger an infinite loop while parsing
> ------------------------------------------------------------------
>
>                 Key: PDFBOX-5401
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5401
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Parsing, PDModel
>    Affects Versions: 3.0.0 PDFBox
>         Environment: Mac OS 12.1 & Ubuntu Linux 16.04 (4.15.0-163-generic)
>            Reporter: Xiaohan Zhang
>            Assignee: Andreas Lehmkühler
>            Priority: Major
>             Fix For: 2.0.26, 3.0.0 PDFBox
>
>         Attachments: verified.zip
>
>
> Hi, I found a crafted pdf that can trigger an infinite loop while parsing 
> using PDFBOX. I have tested on the latest commit of PDFBOX on Github.
>  
> This bug can be triggered by the following code.
> ```
> File ff = new File("path/to/the/sample");
> PDDocument document = Loader.loadPDF(ff);
> ```
>  
> I found that the root cause of this infinite loop resides in the while-loop 
> at line 321 of  [COSParse.java|#L321].]. When parsing the provided PDF files, 
> the variable $prev is never changed during this loop.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to