Wrong EOF detection in CBZip2InputStream
----------------------------------------

                 Key: COMPRESS-157
                 URL: https://issues.apache.org/jira/browse/COMPRESS-157
             Project: Commons Compress
          Issue Type: Bug
            Reporter: Jan
            Priority: Minor


The following snippet form CBZip2InputStream does a wrong EOF check. The char 
'thech' will never be equal to the integer '-1'. You have to check for #read() 
returning -1 before casting to char. 

I found the bug in 
http://svn.wikimedia.org/svnroot/mediawiki/trunk/mwdumper/src/org/apache/commons/compress/bzip2/
 not in your TRUNK.

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



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to