Skip to content

Empty File processing issue #87

@hongtw

Description

@hongtw

for 7-zip archive data, version 0.4, below code would work

types.go 697 ~710

		case idEmptyFile:
			empty, err := readBool(r, emptyStreams)
			if err != nil {
				return nil, err
			}

			j := 0

			for i := range f.file {
				if f.file[i].isEmptyStream {
					f.file[i].isEmptyFile = empty[j]
				}
				j++
			}

But for 7-zip archive data, version 0.3, empty slice may be index out of range.
I found that in version 0.3, the empty file does not appear only in front of the f.file, which causes the index of empty to be taken later on to exceed.

Should j++ write in isEmptyStream condition , like below ?

		case idEmptyFile:
			empty, err := readBool(r, emptyStreams)
			if err != nil {
				return nil, err
			}

			j := 0

			for i := range f.file {
				if f.file[i].isEmptyStream {
					f.file[i].isEmptyFile = empty[j]
					j++
				}
			}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions