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

7z reading of UINT64 data type is wrong for big values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.6
    • 1.7
    • Archivers

    Description

      Brief description

      large values with a first byte indicating at least 4 additional bytes shift an integer by at least 32bits thus leading to an overflow and an incorrect value - the value needs to be casted to long before the bitshift!
      (see the attached patch)

      Details from the 7z documentation

      UINT64 means real UINT64 encoded with the following scheme:
        Size of encoding sequence depends from first byte:
        First_Byte  Extra_Bytes        Value
        (binary)   
        0xxxxxxx               : ( xxxxxxx           )
        10xxxxxx    BYTE y[1]  : (  xxxxxx << (8 * 1)) + y
        110xxxxx    BYTE y[2]  : (   xxxxx << (8 * 2)) + y
        ...
        1111110x    BYTE y[6]  : (       x << (8 * 6)) + y
        11111110    BYTE y[7]  :                         y
        11111111    BYTE y[8]  :                         y
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            nkruber Nico Kruber
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: