incus-mirror/shared
Stéphane Graber 42278bd2b5
shared/archive: Improve detection and error handling
Fuzzing by the 7asecurity team has discovered a few issues with our
handling of compressed images and backups.

This fixes 3 different issues:
 - We weren't checking that 0 bytes at the trailing end of a header were
   in fact 0 in the file itself (checking read length).
 - In case of unpacker error, the client may hang reading from the
   uncompressed pipe unless it implements its own timeout/context mechanism
   calling the canceler.
 - The signature of an uncompressed tarball is based on trailing bytes
   and so should be checked after all of those using leading bytes.

No crashes would result from such bad input but some of the consumers of
those archive functions would be left hanging indefinitely, wasting a
few goroutines.

Reported-by: https://7asecurity.com
Signed-off-by: Stéphane Graber <stgraber@stgraber.org>
2026-04-17 20:41:13 -04:00
..
api shared/api: Add structs for managing dirty bitmaps 2026-04-13 01:12:10 -04:00
archive shared/archive: Improve detection and error handling 2026-04-17 20:41:13 -04:00
ask shared/ask: Don't needlessly use format string functions 2025-05-23 01:44:01 -04:00
cancel shared/cancel: Don't needlessly use format string functions 2025-05-23 01:43:48 -04:00
cgo incusd/forksyscall: Handle mount arguments when using idmap 2026-04-02 18:20:24 -04:00
cliconfig shared/cliconfig: Switch to go-yaml/v4 2026-03-31 16:14:26 -04:00
cmd shared/cmd: Switch to go-yaml/v4 2026-03-31 16:14:27 -04:00
idmap shared/idmap: Skip xattrs on EINVAL 2025-09-24 02:20:17 -04:00
ioprogress shared/ioprogress: Cap download speed to file size 2025-11-28 17:34:06 -05:00
logger incusd/bgp: Port to go-bgp/v4 2026-03-24 17:48:53 -04:00
osarch shared/osarch: Add aliases for the various x86_64 versions 2025-10-24 17:44:48 -04:00
proxy shared/proxy: Make golangci-lint clean 2025-04-03 00:10:36 -04:00
resources shares/resources/usbid: Only load the database once 2025-11-28 02:38:24 -05:00
revert shared/revert: Make golangci-lint clean 2025-04-03 00:10:35 -04:00
scriptlet shared/scriptlet: Move scriptlet utils to shared 2025-08-08 15:49:03 -07:00
simplestreams shared/simplestreams: Don't needlessly use format string functions 2025-05-23 01:42:52 -04:00
subprocess shared/subprocess: Switch to go-yaml/v4 2026-03-31 16:14:28 -04:00
tcp shared/tcp: Don't needlessly use format string functions 2025-05-23 01:42:32 -04:00
termios shared/termios: Fix gofumpt 2025-03-17 20:56:24 -04:00
tls shared/tls: Support multiple domains in ACME functions 2026-02-26 23:07:01 -05:00
units shared/units: Ends all comments with a full-stop. 2022-06-28 10:27:20 +01:00
util shared/util: Fix SingleQuote to actually quote 2026-01-26 07:00:36 -05:00
validate shared/validate: Switch to go-yaml/v4 2026-03-31 16:14:29 -04:00
ws shared/ws: Remove CheckOrigin bypass 2026-03-23 11:17:09 -04:00