commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 32629] New: - Compress: TarInputStream.read() returns wrong values
Date Fri, 10 Dec 2004 09:30:18 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=32629>.
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=32629

           Summary: Compress: TarInputStream.read() returns wrong values
           Product: Commons
           Version: Nightly Builds
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Sandbox
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: ck@newsclub.de


There is a bug in the read() method of sandbox' compress TarInputStream, which
will be triggered only when bytes greater than 127 are being read because of a
bad implicit cast from "byte" to "int" (values >= 128 result in negative int
values, because "byte" is signed). I discovered this when applying a
DataInputStream, which makes heavy use of InputStream.read().

Possible Fix:
Change the "return" line from the TarInputStream.read() function from
  return (int)m_oneBuf[ 0 ];
to
  return (int) (m_oneBuf[0] & 0xFF);


Best regards,
Christian

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


Mime
View raw message