]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
libarchive: Correctly handle option failures 2871/head
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 22 Feb 2026 13:42:39 +0000 (14:42 +0100)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 22 Feb 2026 14:20:48 +0000 (15:20 +0100)
If an incorrect option value has been passed to a filter, it is possible
that library operations continue without even printing a warning.

This can happen because the special value "ARCHIVE_WARN - 1" is only
checked for filter issues, not format issues. Since this special value
is larger than ARCHIVE_FAILED, such failures are silently discarded.

Fix this by checking for this magic value for formats as well.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/archive_options.c

index 6e2c0d2a5971f16be0e0ab03c8b757677a3940b7..66491bd4183bac2f7c9d85cd438bf00eecfedf18 100644 (file)
@@ -90,7 +90,9 @@ _archive_set_either_option(struct archive *a, const char *m, const char *o, cons
        if (r2 == ARCHIVE_FATAL)
                return (ARCHIVE_FATAL);
 
-       if (r2 == ARCHIVE_WARN - 1)
+       if (r1 == ARCHIVE_WARN - 1)
+               return r2;
+       if (r2 == ARCHIVE_WARN -1)
                return r1;
        return r1 > r2 ? r1 : r2;
 }