[
https://issues.apache.org/jira/browse/PDFBOX-6363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tilman Hausherr updated PDFBOX-6363:
------------------------------------
Fix Version/s: 2.0.38
3.0.9 PDFBox
4.0.0
> 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
> 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]