You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by bu...@apache.org on 2003/08/15 11:18:15 UTC

DO NOT REPLY [Bug 22450] New: - Unterminated iteration in JPEGReader class

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22450>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22450

Unterminated iteration in JPEGReader class

           Summary: Unterminated iteration in JPEGReader class
           Product: Fop
           Version: 0.20.5
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: images
        AssignedTo: fop-dev@xml.apache.org
        ReportedBy: zkulcsar@ish.hu
                CC: fop-dev@xml.apache.org


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

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org