You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "Georg Hartmann (JIRA)" <ji...@apache.org> on 2013/12/23 09:32:50 UTC
[jira] [Created] (TIKA-1214) Infinity Loop in Mpeg Stream
Georg Hartmann created TIKA-1214:
------------------------------------
Summary: Infinity Loop in Mpeg Stream
Key: TIKA-1214
URL: https://issues.apache.org/jira/browse/TIKA-1214
Project: Tika
Issue Type: Bug
Components: parser
Affects Versions: 1.4
Environment: local system
Reporter: Georg Hartmann
Fix For: 1.5
Scanning MP3 Files accounter a infiniy loop in the MpegStream Method skipStream
The Call of in.skip returnes zero so the loop never ends.
Simple fix with zero count below
private static void skipStream(InputStream in, long count) throws IOException {
long size = count;
long skipped = 0;
// 5 Times zero equals Error break the loop
int zeroCount = 5;
while (size > 0 && skipped >= 0) {
skipped = in.skip(size);
if (skipped != -1) {
size -= skipped;
}
// Checking for zero to break the infinity loop
if (skipped == 0) {
zeroCount--;
}
if (zeroCount < 0) {
break;
}
}
}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)