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

ASF subversion and git services commented on PDFBOX-6363:
---------------------------------------------------------

Commit 1941199 from Tilman Hausherr in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1941199 ]

PDFBOX-6363: add comment + option

> 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]

Reply via email to