Code Monkey home page Code Monkey logo

Comments (4)

hongtw avatar hongtw commented on August 18, 2024 1

Here is sample, there are two different versions of .7z in it (withEmptyFileVersion3.7z and withEmptyFileVersion4.7z):
sample.zip

Both .7z files contain the same content, both are 2 empty .txt and 1 .txt with text

for file withEmptyFileVersion3.7z with version 0.3

$ file withEmptyFileVersion3.7z
withEmptyFileVersion3.7z: 7-zip archive data, version 0.3

$ 7z l  withEmptyFileVersion3.7z

7-Zip [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.05 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,8 CPUs LE)

Scanning the drive for archives:
1 file, 195 bytes (1 KiB)

Listing archive: withEmptyFileVersion3.7z

--
Path = withEmptyFileVersion3.7z
Type = 7z
Physical Size = 195
Headers Size = 186
Method = LZMA:16
Solid = -
Blocks = 1

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2023-05-25 11:24:23 ....A            4            9  something.txt
2023-05-25 11:24:22 ....A            0            0  empty.1.txt
2023-05-25 11:24:21 ....A            0            0  empty.2.txt
------------------- ----- ------------ ------------  ------------------------
2023-05-25 11:24:23                  4            9  3 files

for file withEmptyFileVersion4.7z with version 0.4

$ file withEmptyFileVersion4.7z
withEmptyFileVersion4.7z: 7-zip archive data, version 0.4

$ 7z l  withEmptyFileVersion4.7z

7-Zip [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.05 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,8 CPUs LE)

Scanning the drive for archives:
1 file, 192 bytes (1 KiB)

Listing archive: withEmptyFileVersion4.7z

--
Path = withEmptyFileVersion4.7z
Type = 7z
Physical Size = 192
Headers Size = 184
Method = LZMA2:12
Solid = -
Blocks = 1

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2023-05-24 11:21:02 ....A            0            0  empty.1.txt
2023-05-24 11:21:04 ....A            0            0  empty.2.txt
2023-05-24 11:21:16 ....A            4            8  something.txt
------------------- ----- ------------ ------------  ------------------------
2023-05-24 11:21:16                  4            8  3 files

And withEmptyFileVersion3.7z would got panic: runtime error: index out of range [2] with length 2

from sevenzip.

bodgit avatar bodgit commented on August 18, 2024 1

The only difference between the two archives seems to be the order of the files within the archive. When the empty files are at the beginning there's no panic but when the empty files appear later, there's a panic.

It looks like your suggestion is correct, the j++ just needs to be moved up within the conditional block.

from sevenzip.

bodgit avatar bodgit commented on August 18, 2024 1

I've made a v1.4.2 release with this issue (hopefully) fixed. Thanks for the bug report!

from sevenzip.

bodgit avatar bodgit commented on August 18, 2024

Can you attach some (ideally small) example archives with empty files that demonstrate it working and not working for the two different archive versions?

I like to add test cases for issues like this to make sure I don't accidentally revert fixes later on.

from sevenzip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.