ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 40919] New: - Bad EOF handling code in CBzip2InputStream
Date Tue, 07 Nov 2006 22:02:24 GMT
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: birdo@parasoft.com


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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message