Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-33

[compress] TarInputStream.read() returns wrong values

    XMLWordPrintableJSON

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

          Activity

            People

              Unassigned Unassigned
              ck@newsclub.de Christian Kohlschütter
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: