Skip to content

Commit

Permalink
fix: remove regression introduced by b269533.
Browse files Browse the repository at this point in the history
When the maintainers of squashfs-tools introduced non-fatal error
hardening, they also introduced a regression for sasquatch.

This was introduced by commit b269533,
where "If the writer thread fails to write a block to the output
filesystem, treat this as a fatal error.".

The problem is that these non-fatal error will happen when sasquatch
enumerate through the different compression implementation, and
especially with LZMA adaptive it appears.

The fix is to explicitly ignore errors during the decompression
attempts.
  • Loading branch information
qkaiser committed Apr 7, 2023
1 parent ef06d23 commit 91b5d70
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions squashfs-tools/compressor.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ extern struct compressor lzma_alt_comp_ops;
extern struct compressor lzma_wrt_comp_ops;
extern struct compressor lzma_adaptive_comp_ops;

extern int ignore_errors;

static struct compressor unknown_comp_ops = {
0, "unknown"
Expand Down Expand Up @@ -173,11 +174,16 @@ int compressor_uncompress(struct compressor *comp, void *dest, void *src, int si
{
int i = 0, retval = -1, default_compressor_id = -1;

int global_ignore_errors = ignore_errors;
ignore_errors = 1;

if(detected_compressor_index)
{
retval = compressor[detected_compressor_index]->uncompress(dest, src, size, block_size, error);
}

ignore_errors = global_ignore_errors;

if(retval < 1 && comp->uncompress)
{
if(!detected_compressor_index) {
Expand Down

0 comments on commit 91b5d70

Please sign in to comment.