]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
rar5: add unpacked-size regression test
authornvmb3r <eharlicaj@gmail.com>
Mon, 29 Jun 2026 00:35:16 +0000 (17:35 -0700)
committernvmb3r <eharlicaj@gmail.com>
Mon, 29 Jun 2026 00:35:16 +0000 (17:35 -0700)
Makefile.am
libarchive/test/test_read_format_rar5.c
libarchive/test/test_read_format_rar5_unpacked_size_exceeds_declared.rar.uu [new file with mode: 0644]

index 6c8467beebdfebce53a41b6b87dba837c6ae08ac..14c10669c38a6b0ec6f8acfc00354f6959b05200 100644 (file)
@@ -1050,6 +1050,7 @@ libarchive_test_EXTRA_DIST=\
        libarchive/test/test_read_format_rar5_stored_manyfiles.rar.uu \
        libarchive/test/test_read_format_rar5_symlink.rar.uu \
        libarchive/test/test_read_format_rar5_truncated_huff.rar.uu \
+       libarchive/test/test_read_format_rar5_unpacked_size_exceeds_declared.rar.uu \
        libarchive/test/test_read_format_rar5_unicode.rar.uu \
        libarchive/test/test_read_format_rar5_win32.rar.uu \
        libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu \
index 57d49ad2fb54ff9b73563c2af761e97f6acffa8e..77f7e8bbf69c1ecb580b6322a1541aabc0721e16 100644 (file)
@@ -1572,3 +1572,17 @@ DEFINE_TEST(test_read_format_rar5_bytes_remaining_underflow)
 
        EPILOGUE();
 }
+
+DEFINE_TEST(test_read_format_rar5_unpacked_size_exceeds_declared)
+{
+       PROLOGUE("test_read_format_rar5_unpacked_size_exceeds_declared.rar");
+
+       assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+       assertEqualString("seed", archive_entry_pathname(ae));
+       assertEqualInt(109, archive_entry_size(ae));
+
+       assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae));
+       assertA(archive_error_string(a) != NULL);
+
+       assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+}
diff --git a/libarchive/test/test_read_format_rar5_unpacked_size_exceeds_declared.rar.uu b/libarchive/test/test_read_format_rar5_unpacked_size_exceeds_declared.rar.uu
new file mode 100644 (file)
index 0000000..df8db21
--- /dev/null
@@ -0,0 +1,10 @@
+begin 644 test_read_format_rar5_unpacked_size_exceeds_declared.rar
+M4F%R(1H'`0!S'-%&"@$%+`8`!0$!@(``PJ.']B("`POG``3M`*2#`E0DF'B`
+M`P$$<V5E9`H#$V0JGU[VYTHYP?]D-50S+Y,[YA3P`1@)46%!68"P&$$H2)$8
+M,V_"7`<'!P<'!P<'!P<'!P<'!P<'!P<'!P<'!P<'!P<'!P<'!P<'!P<'!P<'
+M!P<0R!KGS?_Y1ZGJ/]5[V/WGQV3QS(RALJQ[H%.N$.-9EH-4R%#&),\=!'V$
+MXR:QWL0$Z0'%XQY*.<$4(I44Z>GIZ>GIZ>GIZ>GIZ>GIZ>GIZ>GIZ>GIZ>GI
+MZ>GIZ>GIZ>GIZ>GIZ>GIZ>GIZ>GIZ>GIZ>GIZ>GIZ>GIZ>GIZ>GIZ>GIZ>GI
+;Z>GIZ>G)%78/_6H4^?O2+65;@!UW5E$#!00`
+`
+end