Bug 22450 - Unterminated iteration in JPEGReader class
Summary: Unterminated iteration in JPEGReader class
Status: NEW
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: images (show other bugs)
Version: 0.20.5
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-15 09:18 UTC by Zsolt Kulcsar
Modified: 2012-04-07 01:37 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zsolt Kulcsar 2003-08-15 09:18:14 UTC
Look at the JPEGReader class in the org.apache.fop.image.analyzer package. In
the setDimension(...) method, can have an unterminated iteration. Why?

The method reads bytes from input stream, with a:

while ((marker = imageStream.read()) != MARK) {
   ...
}

Look at the description of the BufferedInputStream.read() method.: "If no byte
is available because the end of the stream has been reached, the value -1 is
returned.".

In the above iteration the author missed check this condition, so the method can
iterate over and over.

Sollution:
Check the end condition.

best regards: Zsolt Kulcsar
Comment 1 Glenn Adams 2012-04-07 01:37:26 UTC
resetting severity from major to normal pending further review