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

Timo Boehme commented on PDFBOX-2996:
-------------------------------------

I had a look on the QuickSort.java attachment. First it is still a recursive 
algorithm - and I thought an iterative version was proposed to overcome the 
Stackoverflow exception? Second the implementation seems to be broken - I ran a 
2-element test (in my head), say a list of \{2,1\}. 2 is pivot; {{i}} is 
incremented, {{j}} not decremented -> {{i==j}} -> we have a (nonsense swap) and 
{{i=2; j=0}}. Thus the list comes out unchanged.

It seems you should think about the algorithm in depth again and maybe if a 
true iterative version is possible.

> StackOverflow in Quicksort
> --------------------------
>
>                 Key: PDFBOX-2996
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2996
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Text extraction
>    Affects Versions: 1.8.10, 2.0.0
>         Environment: Java 7
>            Reporter: Manuel Aristaran
>         Attachments: 001991.pdf, QuickSort.java, 
> artikel1_20_arab.pdf-sorted-diff.txt, artikel1_20_arab.pdf-sorted-iter.txt, 
> artikel1_20_arab.pdf-sorted-rekur.txt, failing_sort.pdf, quicksort.patch
>
>
> Running PDFTextStripper through ExtractText triggers a StackOverflow 
> exception in the QuickSort implementation for [this particular 
> document|https://www.dropbox.com/s/6crie7y5gqadwa5/1.pdf?dl=0].
> To reproduce: {{java -jar pdfbox-app-1.8.11-SNAPSHOT.jar ExtractText -sort 
> failing_sort.pdf}}
> (Related to PDFBOX-1512)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to