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

SharpZipLib and ziparchive open issue #206

Closed
1 task done
IrvinDominin opened this issue Dec 18, 2017 · 1 comment
Closed
1 task done

SharpZipLib and ziparchive open issue #206

IrvinDominin opened this issue Dec 18, 2017 · 1 comment

Comments

@IrvinDominin
Copy link

Steps to reproduce

1.Create an encrypted file using the following code
2.Try to extract a single file (the first inserted) using a c++ application using ziparchive
3.Issue on uncrompressed size

Code:
Protected _file As ZipFile

    Public Sub New(ByVal pathName As String)
        If Not File.Exists(pathName) Then
            Try
                _file = ZipFile.Create(pathName)
            Catch ex As Exception
            End Try
        Else
            Try
                _file = New ZipFile(pathName)
            Catch ex As Exception
            End Try
        End If
    End Sub

    Public Sub Insert(ByVal name As String,
                      ByVal streamFile As Stream)

        Dim sds As New CustomStaticDataSource
        sds.SetStream(streamFile)          

        Try
            _file.BeginUpdate()
            _file.Add(sds, name)                
            _file.CommitUpdate()
        Catch ex As Exception
            Throw
        End Try

    End Sub

    Private Class CustomStaticDataSource
        Implements IStaticDataSource

        Private _stream As Stream
        Public Function GetSource() As Stream Implements IStaticDataSource.GetSource
            Return _stream
        End Function

        Public Sub SetStream(inputStream As Stream)
            _stream = inputStream
            _stream.Position = 0
        End Sub
    End Class

Expected behavior

I'm creating a password protected zip file using SharpZipLib and inserting 3 files:

  1. Demo.xml
  2. Code.pdf
  3. File.htm
    The file can be opened and unzipped with windows and 7zip.

Actual behavior

When I try to open it and extract the first file from a C++ application on windows it fails regularly, I'm using ziparchive.

Ziparchive detect it as corrupted by checking the consistence of crc, compressed and original size.

The issue is that the uncompressed size is not correctly detected, but always detected as hex 04034b50 (decimal 67324752).

Is there any option that must be set in order to fix this issue?

Version of SharpZipLib - 0.86.0.518

Obtained from (place an x between the brackets for all that apply)

  • [ ] Compiled from source
  • Downloaded DLL from GitHub
  • [ ] Downloaded DLL from SourceForge
  • [ ] Downloaded DLL from _______
  • [ ] DLL included as part of
@IrvinDominin
Copy link
Author

Issue confirmed and fixed by ziparchive

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