You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2006/07/05 05:57:40 UTC

[jira] Updated: (SANDBOX-44) [compress] TarInputStream.read() returns wrong values

     [ http://issues.apache.org/jira/browse/SANDBOX-44?page=all ]

Henri Yandell updated SANDBOX-44:
---------------------------------

    Component: Compress

> [compress] TarInputStream.read() returns wrong values
> -----------------------------------------------------
>
>          Key: SANDBOX-44
>          URL: http://issues.apache.org/jira/browse/SANDBOX-44
>      Project: Commons Sandbox
>         Type: Bug

>   Components: Compress
>     Versions: Nightly Builds
>  Environment: Operating System: All
> Platform: All
>     Reporter: Christian Kohlschütter

>
> 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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org