Vikram Shrowty created TIKA-3080:
------------------------------------

             Summary: CharsetMatch.getString can get stuck in infinite loop
                 Key: TIKA-3080
                 URL: https://issues.apache.org/jira/browse/TIKA-3080
             Project: Tika
          Issue Type: Bug
          Components: parser
    Affects Versions: 1.24
            Reporter: Vikram Shrowty


In here:

[https://github.com/apache/tika/blob/fb5a191edac2cef28c0a4ac390c9156acdc9e673/tika-parsers/src/main/java/org/apache/tika/parser/txt/CharsetMatch.java#L147-L150]

If you specify a maxLength and the stream is long enough, the max variable in 
the loop goes to zero and the loop then gets stuck because you're asking to 
read 0 bytes but not exiting unless the number of bytes read is < 0. 

Looks like the condition ought to be > 0 instead of >= 0.

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to