Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Zip64 extended information record format #46

Open
IEVin opened this issue Jul 6, 2022 · 0 comments
Open

Invalid Zip64 extended information record format #46

IEVin opened this issue Jul 6, 2022 · 0 comments

Comments

@IEVin
Copy link

IEVin commented Jul 6, 2022

Hi!
Thanks for awesome tool to work with zip! Unfortunately i ran into a problem when reading the zip64 file.

According with zip format specification fields in zip64 extended information record MUST only appear if the corresponding Local or Central directory record field is set to 0xFFFF or 0xFFFFFFFF

This issue may be fixed by change // ZIP64 Information block in ReadExtraInfo function to this:

if (extraId == 0x0001) // ZIP64 Information
{
    int extraOffset = 4;
    if (_zfe.FileSize == 0xFFFFFFFF)
    {
        _zfe.FileSize = BitConverter.ToInt64(buffer, pos + extraOffset);
        extraOffset += 8;
    }
    if (_zfe.CompressedSize == 0xFFFFFFFF)
    {
        _zfe.CompressedSize = BitConverter.ToInt64(buffer, pos + extraOffset);
        extraOffset += 8;
    }
    if (_zfe.HeaderOffset == 0xFFFFFFFF)
    {
        _zfe.HeaderOffset = BitConverter.ToInt64(buffer, pos + extraOffset);
    }
}

And calculate zfe.FileOffset after invocation ReadExtraInfo.

But CreateExtraInfo should be rewrited to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant