Commit Graph

12 Commits (4436222e90e0b3d7f4901b7b83e343e398fb9440)

Author SHA1 Message Date
Timo Teräs fedaa44546 io_gunzip: fix handling short reads near end-of-file
The gzip library can drain all of the input to internal buffers
and still keep providing data even if avail_in is zero. Previously
it was assumed that avail_in != 0 if there is still data expected out,
but this logic breaks near end-of-file for multiple short reads.

Adjust logic to not process end-of-file event too early.

fixes #10809
2022-02-21 12:36:46 +02:00
Ariadne Conill f4f7796ccc everywhere: use stdlib.h for malloc(3) definition, not GNU-specific malloc.h
musl implements support for malloc.h, but it is only a stub.  we do not use
any of the GNU-specific malloc interfaces, so just use POSIX stdlib.h instead.

ref #10794
2021-12-14 16:23:29 +00:00
Timo Teräs 72d8cb8937 remove IS_ERR_OR_NULL
In most places where pointer can be an 'error' it cannot be null
pointer. Further, in those cases just calling PTR_ERR() is not enough
to handle the null case. Simplify code by removing this case.

If NULL case needs to be handled, it's better to add separate check
and return fixed error code in that case.
2021-08-23 17:02:50 +03:00
Timo Teräs 395e92b66e io: formalize apk_ostream_write() always writing full data 2021-07-22 15:30:08 +03:00
Timo Teräs 796d298313 rework apk_istream_splice and apk_istream_tee
- apk_istream_splice usage is converted to apk_stream_copy which
  is the newer variant. With caching enabled by default, this
  makes more sense mmapping or using separate buffers.

- apk_istream_tee is reworked to write to apk_ostream, which simplifies
  quite a bit of various things
2021-07-22 15:30:08 +03:00
Timo Teräs b559a81694 io: rework apk_istream_get_* to not return erros in blob value
The interface was slightly cumbersome, so replace these functions
to return explicit error, and make the return blob a pointer arg.
2021-07-22 15:30:08 +03:00
Timo Teräs 7af34db6cf adb: support seamless de/compression of adb files
Add compression header of adb files. Support uncompressed and
deflate compression at this time.
2021-07-22 15:30:08 +03:00
Timo Teräs b43da45bc3 gunzip: fix false end-of-file condition in rare circumstances
It turns out inflate() can output zero bytes, even if it consumed
data. This had the unfortunate side effect of returning zero bytes
(end-of-file) condition before calling the boundary callbacks. This
fixes the logic to not return zero reads on gzip boundary.

In practice this fixes the seldom seen issues of apk reporting
bad signature (when it was correct).
2021-02-04 21:38:30 +02:00
thibault.ferrante 0fb0d30477 database: Propagate errors when loading an APKINDEX
In case of failure when loading an APKINDEX, no errors are
propagated to the user which may uncorrectly interpret the
current problem.
2021-01-11 11:26:49 +02:00
Timo Teräs 5f66b618ef various changes to make clang not give warnings 2020-10-07 21:16:35 +03:00
TBK 5d796b5678 use SPDX-License-Identifier in source files 2020-05-07 10:45:42 +03:00
Timo Teräs 6d11ec36e6 rename all iostream source to io_*.c 2020-02-14 16:53:12 +02:00