summaryrefslogtreecommitdiff
path: root/src/gunzip.c
AgeCommit message (Collapse)AuthorFilesLines
2020-02-14rename all iostream source to io_*.cTimo Teräs1-252/+0
2020-01-11convert remaining locations to use istream instead of bstreamTimo Teräs1-12/+10
2020-01-11istream: add buffering capabilityTimo Teräs1-22/+12
Convert all implementations to do buffering. This is in preparation to remove bstream interface as redundant. istream_read() will return full reads unless end-of-file. The backends can return short reads to optimize buffering or due to other reasons like boundary change for gz.
2020-01-06io: remove unused size parameter from bstream closeTimo Teräs1-2/+2
2019-12-18io: use proper base struct types for method implementationsTimo Teräs1-14/+11
2018-09-10rework unpacking of packages and harden package file format requirementsTimo Teräs1-21/+14
A crafted .apk file could to trick apk writing unverified data to an unexpected file during temporary file creation due to bugs in handling long link target name and the way a regular file is extracted. Several hardening steps are implemented to avoid this: - the temporary file is now always first unlinked (apk thus reserved all filenames .apk.* to be it's working files) - the temporary file is after that created with O_EXCL to avoid races - the temporary file is no longer directly the archive entry name and thus directly controlled by potentially untrusted data - long file names and link target names are now rejected - hard link targets are now more rigorously checked - various additional checks added for the extraction process to error out early in case of malformed (or old legacy) file Reported-by: Max Justicz <max@justi.cz>
2017-06-23io: make io vtables const struct, and add accessors for themTimo Teräs1-13/+21
This reduces function pointers in heap, and unifies how the io functions are called.
2015-11-09io, database: preserve [am]time for cached and fetched filesTimo Teräs1-0/+8
preserve [am]time for all packages and indexes. this fixes the caching error that 'apk update' is after new index is generated, but before the used mirror is synchronized. this caused local apkindex timestamp to be newer than file in mirror, when in fact it was outdated index. this also fixes fetched files to have build timestamp so that files going to .iso or custom images have proper timestamps (rsync with appropriate --modify-window now works)
2015-03-10rework error handling for read streamsTimo Teräs1-4/+3
2014-10-08io,url,db: support for if-modified-sinceTimo Teräs1-3/+2
2014-10-07io: fix few error path leaksTimo Teräs1-4/+2
2011-09-13all: update copyright year statementTimo Teräs1-1/+1
2010-12-17gunzip: fix ordering of boundary callbacksTimo Teräs1-8/+24
The boundary callback should not happen until all the uncompressed data has been consumed. This previously seems to have worked because normally gzip library returns "no error" instead of the "stream end" if we extract exactly the amount of bytes remaining in the archive. (Perhaps this was changed in new zlib.) In any case, verification was broken with some apks due to this callback ordering issue.
2010-12-09io: enhance istream/bstreams with pipe to forked childTimo Teräs1-2/+2
* prunes the child pid to avoid zombies * handles the errors so e.g. file-not-found is reported properly
2009-08-12io: better error handling when writing stuff outTimo Teras1-4/+9
also have the output stream support writing to temporary file and do renameat/unlinkat on close depending on if all writes succeeded or not.
2009-07-22pkg: cleanup the signing codeTimo Teras1-3/+8
smaller callback and less cases to check. also reintroduce the oneshot digest flag, hopefully correct this time.
2009-07-22various: more informative error messagesTimo Teras1-12/+12
2009-07-22various: installation fixesTimo Teras1-8/+8
- extract everything as .apk-new and overwrite only after data has been checksummed - url construction fixes (to work with simple http servers) - end of gunzip stream fixed - remove oneshot digesting flag for now as it's usage was broken
2009-07-21pkg: fix indexing of multi-part apksTimo Teras1-21/+27
2009-07-21db: fixes to package checksumming while installing itTimo Teras1-3/+10
2009-07-20gzip: fix finalization of compressed outputTimo Teras1-5/+8
the unflushed data when closing file can be several thousand kiloes, loop until all is written out.
2009-07-17digest: use oneshot context flag where approriateTimo Teras1-25/+19
speeds up digest calculation on some cases.
2009-07-17pkg: fix index generationTimo Teras1-7/+10
that got broke during verify implementation.
2009-07-16various: new style index generationTimo Teras1-9/+89
change the index generation to do old index, or the new style index where package identity is sha1 of control block and it's contained within an .tar.gz to allow signing in future.
2009-07-16gzip: always autoclose the inner streamTimo Teras1-5/+2
2009-07-14bstream: make tokenizable and load index using bstreamTimo Teras1-1/+5
some fixes on index reading code too.
2009-07-13io: move csumming away from bstream to gunzipTimo Teras1-8/+41
in future we want to checksum on gzip boundary basis, not the full file.
2009-07-10gunzip: accept concatenated gzip streamsTimo Teras1-1/+11
allow .apk to consist of multiple separate gzip streams which are just concatenated together.
2009-01-06io: fix some memory leaksTimo Teras1-1/+5
2009-01-06io: check inner stream existance before creating gunzip streamTimo Teras1-0/+3
2008-11-28io: apk_ostream stuffTimo Teras1-1/+1
2008-11-14db: checksum installed files, protect config filesTimo Teras1-1/+0
Checksum of installed is computed on the fly when extracting them and it'll be saved to fdb. When installing config files those are diverted with suffix .apk-new if earlier version of same file with local changes exist.
2008-11-07use zlib internally to decompressTimo Teras1-0/+93