Commons Compress
  1. Commons Compress
  2. COMPRESS-114

TarUtils.parseName does not properly handle characters outside the range 0-127

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1
    • Component/s: None
    • Labels:
      None
    • Environment:

      Windows/Suse

      Description

      if a tarfile contains files with special characters, the names of the tar entries are wrong.

      example:
      correct name: 0302-0601-3±±±F06±W220±ZB±LALALA±±±±±±±±±±CAN±±DC±±±04±060302±MOE.model
      name resolved by TarUtils.parseName: 0302-0101-3ᄆᄆᄆF06ᄆW220ᄆZBᄆHECKMODULᄆᄆᄆᄆᄆᄆᄆᄆᄆᄆECEᄆᄆDCᄆᄆᄆ07ᄆ060302ᄆDOERN.model

      please use:
      result.append(new String(new byte[]

      { buffer[i] }

      ));

      instead of:
      result.append((char) buffer[i]);

      to solve this encoding problem.

      1. plusMinusForJIRAwithLicense.tar
        10 kB
        Helmut Minst
      2. TarUtils.java
        9 kB
        Helmut Minst
      3. TarArchiveInputStream.java
        11 kB
        Helmut Minst
      4. TarArchiveEntry.java
        20 kB
        Helmut Minst

        Activity

        Helmut Minst created issue -
        Helmut Minst made changes -
        Field Original Value New Value
        Attachment plusMinusForJIRA.tar [ 12444672 ]
        Helmut Minst made changes -
        Attachment TarArchiveEntry.java [ 12444673 ]
        Attachment TarArchiveInputStream.java [ 12444674 ]
        Attachment TarUtils.java [ 12444675 ]
        Helmut Minst made changes -
        Attachment plusMinusForJIRAwithLicense.tar [ 12444676 ]
        Helmut Minst made changes -
        Attachment plusMinusForJIRA.tar [ 12444672 ]
        Sebb made changes -
        Summary determine name for TarEntries with special characters in TarUtils.parseName TarUtils.parseName does not properly handle characters outside the range 0-127
        Sebb made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.1 [ 12313772 ]
        Resolution Fixed [ 1 ]
        Pavel made changes -
        Comment [ Hi Stefan,

        thanks for a swift reply!

        I'm using Sun JDK 1.6.0_06, if it helps. I've checked out the project using Eclipse 3.6 and built it with the Maven plugin for Eclipse.

        thx ]
        Helmut Minst made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Helmut Minst
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development