[
https://issues.apache.org/jira/browse/PDFBOX-6363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18154689#comment-18154689
]
Tilman Hausherr commented on PDFBOX-6363:
-----------------------------------------
Sorry for the noise, I misunderstood it initially. (before reading the comments
+ PR)
Thanks for the PR but the main part is too complex, but I used a few parts.
I'll look for the test next.
> PDFHighlighter treats search words as regular expressions, so user terms can
> hang a thread or throw
> ---------------------------------------------------------------------------------------------------
>
> Key: PDFBOX-6363
> URL: https://issues.apache.org/jira/browse/PDFBOX-6363
> Project: PDFBox
> Issue Type: Bug
> Components: Examples
> Affects Versions: 2.0.37, 3.0.8 PDFBox
> Reporter: Simon Steiner
> Priority: Minor
> Fix For: 2.0.38, 3.0.9 PDFBox, 4.0.0
>
>
> PDFHighlighter.generateXMLHighlight takes one or more search words,
> documented as "the word to search for". At the end of each page, endPage
> passes each word straight to Pattern.compile(searchedWord,
> Pattern.CASE_INSENSITIVE) and runs matcher.find() over the whole page text.
> The words are never escaped with Pattern.quote or Pattern.LITERAL, so regex
> metacharacters are interpreted. A term with nested quantifiers can backtrack
> catastrophically against the page text. A term with an unbalanced bracket, or
> a word like C++, throws an unchecked PatternSyntaxException instead of the
> declared IOException. A . matches any character, so highlight positions come
> out wrong.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]