Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
-
None
-
Operating System: All
Platform: All
-
32629
Description
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
Attachments
Issue Links
- duplicates
-
COMPRESS-23 [compress] TarInputStream returns negative value for read() [PATCH]
- Closed