Menu

#352 7z GPT name conflicting fix proposal

open
nobody
5
2020-04-28
2020-03-02
bertil
No

Hi team,

On both 20.00 alpha and 19.00, a GPT based disk image with 2 partitions shows this:

C:\>"C:\Program Files\7-Zip\7z.exe" l container_with_2_partitions_ntfs_fat.vhd

7-Zip 20.00 alpha (x64) : Copyright (c) 1999-2020 Igor Pavlov : 2020-02-06

Scanning the drive for archives:
1 file, 33554944 bytes (33 MiB)

Listing archive: container_with_2_partitions_ntfs_fat.vhd

--
Path = container_with_2_partitions_ntfs_fat.vhd
Type = VHD
Physical Size = 33554944
Offset = 0
Created = 2020-02-27 16:13:45
Method = Fixed
Creator Application = win 10.0
Host OS = Windows
Saved State = -
ID = E24D9DB05A3F824781E2A71D36F1F4AB
----
Size = 33554432
Packed Size = 33554432
Created = 2020-02-27 16:13:45
--
Path = container_with_2_partitions_ntfs_fat.gpt
Type = GPT
Physical Size = 33554432
ID = D2C0AEEE-68F1-48A0-992B-97C95277825B

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
                    .....      8388608      8388608  Basic data partition.img
                    .....     23068672     23068672  Basic data partition.img
------------------- ----- ------------ ------------  ------------------------
                              31457280     31457280  2 files

This filename conflict issue leads to partition 2 overwriting partition 1 during extraction.

Proposed fix:
--- a/CPP/7zip/Archive/GptHandler.cpp 2020-03-02 14:55:33.475401200 +0000
+++ b/CPP/7zip/Archive/GptHandler.cpp 2020-03-02 14:55:45.269851500 +0000
@@ -341,7 +341,9 @@
break;
s += c;
}
- s.Add_UInt32(index);
+ if (!s.IsEmpty())
+ s += '.';
+ s.Add_UInt32(index);
{
s += '.';
const char *ext = NULL;

POC attached.

1 Attachments

Discussion

  • Igor Pavlov

    Igor Pavlov - 2020-03-03

    Ok.
    I'll change that code.
    I'll put the partition number to front of name.
    Thanks for report!

     
    • bertil

      bertil - 2020-04-28

      Any idea on the release data of the fix?

       

Log in to post a comment.