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

http://issues.apache.org/bugzilla/show_bug.cgi?id=40919

           Summary: Bad EOF handling code in CBzip2InputStream
           Product: Ant
           Version: 1.6.5
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: [EMAIL PROTECTED]


org.apache.tools.bzip2.CBZip2InputStream has the following code that
attempts to detect an unexpected EOF (similar code appears in three different
places in the file)

char thech = 0;
try {
    thech = (char)m_input.read();
} catch( IOException e ) {
    compressedStreamEOF();
}
if( thech == -1 ) {
    compressedStreamEOF();
}

m_input.read will return an int in the range [-1..255]

Since char is unsigned, when -1 is returned, thech will have the max char value.
Later, the condition thech == -1 will implicitly covert thech back to some
positive int (not -1) so thech == -1 will always return false.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to