gianlucabertani / Objective-Zip

An object-oriented friendly wrapper library for ZLib and MiniZip, in Objective-C for iOS and OS X
BSD 3-Clause "New" or "Revised" License
412 stars 133 forks source link

Crash when trying to unzip file #42

Open erwinl opened 8 years ago

erwinl commented 8 years ago

Hello, first of all thanks for the library.

When trying to unzip a zip file, it always crash for me on this step:

OZZipFile *unzipFile= [[OZZipFile alloc] initWithFileName:@"test.zip" mode:OZZipFileModeUnzip];

I double checked and the zip file is exist and can be unzipped correctly by OSX archiver. Zip file is created by OSX archiver.

It always crash on: unzip.c > unzOpenInternal() line 577 unzGoToFirstFile((unzFile)s);

#0  0x00000001842bb7b8 in flockfile ()
#1  0x00000001842c7488 in fseek ()
#2  0x0000000100371ca0 in unzlocal_GetCurrentFileInfoInternal ()
#3  0x0000000100372d08 in unzGoToFirstFile ()
#4  0x000000010013a4bc in unzOpenInternal at /Users/Est/tiramisu/Pods/objective-zip/MiniZip/unzip.c:577
#5  0x000000010013a500 in unzOpen64 at /Users/Est/tiramisu/Pods/objective-zip/MiniZip/unzip.c:613
#6  0x0000000100130ff4 in -[OZZipFile initWithFileName:mode:legacy32BitMode:] at /Users/Est/tiramisu/Pods/objective-zip/Objective-Zip/OZZipFile.m:98
#7  0x0000000100130e20 in -[OZZipFile initWithFileName:mode:] at /Users/Est/tiramisu/Pods/objective-zip/Objective-Zip/OZZipFile.m:83
#8  0x0000000100131320 in -[OZZipFile initWithFileName:mode:error:] at /Users/Est/tiramisu/Pods/objective-zip/Objective-Zip/OZZipFile.m:134

Any idea why it crash when initializing the OZZipFile ? Thanks in advance.

evands commented 8 years ago

Several possibilities, but one thought: You're not specifying a full path; try [[NSBundle mainBundle] pathForResource:@"test" ofType:@"zip"] if this file is in your bundle, or the full path if you've downloaded it.

erwinl commented 8 years ago

Hello @evands, I made sure that the zip file is there.