From: LoboQ1ng Date: Fri, 20 Mar 2026 21:57:18 +0000 (+0000) Subject: test: resolve SonarQube code smell by removing redundant conditional X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=32c657202357089ef0905e7ae32737a32830c497;p=thirdparty%2Flibarchive.git test: resolve SonarQube code smell by removing redundant conditional --- diff --git a/libarchive/test/test_read_format_cab_lzx_oob.c b/libarchive/test/test_read_format_cab_lzx_oob.c index 14c89b889..a4c15d62f 100644 --- a/libarchive/test/test_read_format_cab_lzx_oob.c +++ b/libarchive/test/test_read_format_cab_lzx_oob.c @@ -28,17 +28,13 @@ DEFINE_TEST(test_read_format_cab_lzx_oob) /* Read the header of the malformed entry */ if (ARCHIVE_OK == archive_read_next_header(a, &ae)) { - /* * We do NOT assert ARCHIVE_OK here. The file is intentionally malformed. - * The goal is to ensure the patched decoder catches the malicious size - * and returns an error (ARCHIVE_FATAL or ARCHIVE_WARN) instead of crashing. - */ - if (archive_read_data_block(a, &buff, &size, &offset) == ARCHIVE_OK) { - archive_read_data_skip(a); - } else { - /* Even if the first block read fails, force a skip to test state handling */ + /* * We attempt to read a block to initialize the LZX state machine. + * We do not assert the result because the file is intentionally malformed. + * Regardless of success or failure, we force a skip to test state handling + * and trigger the vulnerability. + */ + archive_read_data_block(a, &buff, &size, &offset); archive_read_data_skip(a); - } - /* * Optional: We could assert that the error string contains our patch message, * but simply surviving without a segfault/ASAN violation is the primary goal * for fuzzing regression tests.