Comments (4)
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.
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.
I've made a v1.4.2 release with this issue (hopefully) fixed. Thanks for the bug report!
from sevenzip.
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)
- runtime error: index out of range [0] with length 0 HOT 9
- "invalid memory address or nil pointer dereference" when opening 7z file HOT 1
- Errors are not accessible since they are private with a lower case
- Low performance of .7z files with password HOT 2
- Extract files from a self-extracting exe HOT 8
- panic: runtime error: index out of range HOT 2
- low performance for aes7z HOT 2
- warning: a function definition without a prototype is deprecated in all versions HOT 2
- 解带密码的提示 Failed to open file in archive: lzma: unsupported chunk header byte HOT 1
- How to extract HOT 1
- Return list of volume archive files. HOT 14
- seek over file in archive HOT 2
- Support BCJ method HOT 8
- Support PPC method
- Unable to decrypt 7-ZIP file with password (err: breader.ReadByte: no data!) HOT 1
- Unable to decrypt 7-ZIP file with password (err: breader.ReadByte: no data!) HOT 1
- sevenzip as a guide HOT 3
- Add support for reading self-extracting archives
- Fail to read .exe in .7z HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sevenzip.