-
Notifications
You must be signed in to change notification settings - Fork 39
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
Signature Error #1
Comments
The same to me... 👍 |
I am also getting this. In my case, I am streaming zip files from an ftp. When I download the zip files manually via browser and unzip them myself, they work fine (using Keka on OSX, and also the command-line unzip utility). I saw on node-unzip someone had a similar problem (streaming from HTTP, instead of FTP), and they said if they save the file to local filesystem first and then read it back in, the error would go away (EvanOxfeld#73). This workaround worked for me too -- though oddly, in the node-unzip issue, someone specifically claimed that bug was fixed in this fork |
The same to me .... |
+1 please fix |
for my file, the invalid signature is 0x4b500003 |
The problem with streaming ZIP files is that you cannot read the central directory header (located at the end of the file). Some ZIP files don't store the compressed/uncompressed sizes in the local file header, because the (un)compressed size isn't known upfront. In that situation the size is set to 0 and a data descriptor is located at the end of the (compressed) data. But you don't know the data length, so you don't know where to look for it. Non-streaming unzippers just take a look at the central directory and get the size from there. Due to the streaming character of this module, this isn't possible. The data descriptor starts with 0x08074b50, so this module tries to look for this DWORD in the (compressed) data. If it is found, then it assumes that it has found the end of the data. Although this might work, it's pretty error prone. There is no escaping method, so you don't know if you have matched data or the actual data descriptor. This especially fails when storing ZIP files inside a ZIP file. You might hit the magic numbers of the embedded ZIP-file. You could do some additional checking to prevent this from happening. The compressed size should match the number of bytes you have actually read. If that doesn't match, then you probably got the incorrect data descriptor. You could also check CRCs. If it matches, then you're pretty sure that you got the correct data descriptor. If it doesn't, then the ZIP-file is corrupt anyway. |
The invalid signature byte is just file data, where it expected to find a signature. The data depends on the data that is stored. |
I got same error with large zip. It had lots of xml files. When I unzipped the content manually with other tools and zipped it again I got the same error. When I unzipped files and separated then into smaller chunks and zipped it again into multiple smaller zips - everything was okay. |
+1 |
can anyone provide an example zip file that reproduces this problem? |
Hey guys. Have the same error in exceljs lib loading xlsx-file.
|
@PhoenixUA, would you mind providing the document (or a document) that reproduces the problem? I'm familiar with the zip file binary format, and I'm curious to know what exactly the issue is. |
@thejoshwolfe yep, take that. |
@PhoenixUA, are you sure that document reproduces the issue? It seems to work find for me with this library (checked out at master) and node v4.2.6.
The above command completes without errors. |
I get the same error with a different file.
|
That zipfile uses general purpose bit 3, which is a feature that this node module doesn't seem to support. (It is a bit strange that a directory entry has a non-zero uncompressed size, but the central directory record is correct, so a spec compliant zip file reader should have no trouble with it.) I recommend anyone getting this error should switch to my module yauzl for zipfile reading, or at least test to see if the |
@thejoshwolfe thanks for the clarification! The zip file was created using Java's |
I experienced this problem until I added on('error') handler to the unzipped stream:
See this comment. That works even without retrying unzipping. |
Getting the same error, but when you retry this file, it's OK! |
Can someone give me a suggestion? |
@penybai Try saving the file to the local filesystem, and then opening a new stream to read the saved file and unzipping that. This has worked for me, though some of the later comments imply it doesn't work for all situations. |
I got the same Problem ... ( invalid signature: 0x8074b50 ) |
Hi,
I am getting
Error: invalid signature: 0x7853666a
on some files.
A sanity test of the zip file as well as the regular unzip shell command work fine without any issues.
Please advise
The text was updated successfully, but these errors were encountered: