Bug 22450

Summary: Unterminated iteration in JPEGReader class
Product: Fop - Now in Jira Reporter: Zsolt Kulcsar <zkulcsar>
Component: imagesAssignee: fop-dev
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 0.20.5   
Target Milestone: ---   
Hardware: Other   
OS: other   

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