4 ms·
not really. The zip spec says anything can come in before the "zip data". Info-Zip gives this example unzip unz552x3.exe unzipsfx.exe // e
by greggman3 6y ago
not really.
The zip spec says anything can come in before the "zip data". Info-Zip gives this example
unzip unz552x3.exe unzipsfx.exe // extract the DOS SFX stub
cat unzipsfx.exe yourzip.zip > yourDOSzip.exe // create the SFX archive
zip -A yourDOSzip.exe // fix up internal offsets
http://infozip.sourceforge.net/FAQ.html#unixSFX http://infozip.sourceforge.net/FAQ.html#unixSFX
In other words, append any data you want, then fix the pointers in the central directory.
There are tons of various zip utilities that will mess up depending on what you put in that self extractor including MacOS's built in finder based zip support.
PKWare, the keepers of the documentation for the ZIP format refuse to specify that you must read the end of central directory. They do this by claiming you can stream a zip file. But you can't stream a zip file if you have to read the central directory because data you may have already used, "the definition of streaming", maybe not be listed in the central directory in which case you shouldn't have used it.
In other words imagine each file in the zip is a compressed script and you are going to execute them. Imagine there are 2 scripts, the first one is "rm -rf /" and the second "ls /". The central directory only points to the 2nd script but if you stream you'll read the first script an execute it.
The ZIP spec claims you can stream but clearly you can't.