]> git.ipfire.org Git - thirdparty/libarchive.git/log
thirdparty/libarchive.git
4 years ago3.4.0 v3.4.0
Martin Matuska [Tue, 11 Jun 2019 19:53:23 +0000 (21:53 +0200)] 
3.4.0

4 years agoRemove unused members of struct lafe_line_reader
Marc Espie [Tue, 11 Jun 2019 00:01:26 +0000 (02:01 +0200)] 
Remove unused members of struct lafe_line_reader

Fixes #1211

4 years agoUpdate specfile to a version usable on copr
Martin Matuska [Mon, 10 Jun 2019 21:27:33 +0000 (23:27 +0200)] 
Update specfile to a version usable on copr

4 years agoMerge lib/libc/gen/readpassphrase.c v 1.27 from OpenBSD
Martin Matuska [Sun, 9 Jun 2019 23:31:56 +0000 (01:31 +0200)] 
Merge lib/libc/gen/readpassphrase.c v 1.27 from OpenBSD

Fixes #1209

4 years agoarchive_write_disk_posix changes
Martin Matuska [Thu, 6 Jun 2019 13:12:11 +0000 (15:12 +0200)] 
archive_write_disk_posix changes
- private file descriptor in _archive_write_disk_close()
- use la_opendirat() in edit_deep_directories()

4 years agoFix typo in tar/bsdtar.1
Martin Matuska [Thu, 6 Jun 2019 12:58:25 +0000 (14:58 +0200)] 
Fix typo in tar/bsdtar.1

4 years agoMore bsdtar.1 manpage fixes
Martin Matuska [Mon, 3 Jun 2019 21:51:44 +0000 (23:51 +0200)] 
More bsdtar.1 manpage fixes

- use term "extended file attributes"
- use term "file attributes or file flags"

4 years agoMinor bsdtar.1 manpage fixes
Martin Matuska [Mon, 3 Jun 2019 21:33:49 +0000 (23:33 +0200)] 
Minor bsdtar.1 manpage fixes

- the -p option does not restore owner by default.
- the -n option was listed twice
- file flags are called file attributes on Linux and are platform-specific

Fixes #1204

4 years agoAdd missing HAVE_UNLINKAT to build/cmake/config.h.in
Martin Matuska [Mon, 3 Jun 2019 14:29:58 +0000 (16:29 +0200)] 
Add missing HAVE_UNLINKAT to build/cmake/config.h.in

4 years agoFix typo in CMakeLists.txt and build/ci/build.sh
Martin Matuska [Fri, 31 May 2019 22:49:48 +0000 (00:49 +0200)] 
Fix typo in CMakeLists.txt and build/ci/build.sh

4 years agoarchive_write_disk: remove some obsolete TODO comments
Martin Matuska [Sun, 26 May 2019 00:21:51 +0000 (02:21 +0200)] 
archive_write_disk: remove some obsolete TODO comments

4 years agoarchive_write_disk_posix: check_symlinks_fsobj() without chdir()
Martin Matuska [Sat, 25 May 2019 23:48:39 +0000 (01:48 +0200)] 
archive_write_disk_posix: check_symlinks_fsobj() without chdir()

only on platforms with openat(), fstatat() and unlinkat() support

4 years agoarchive_write_disk_posix: open a fd when processing fixup entries
Martin Matuska [Sat, 25 May 2019 21:46:59 +0000 (23:46 +0200)] 
archive_write_disk_posix: open a fd when processing fixup entries

4 years agoarchive_write_disk_posix: simplify set_mode()
Martin Matuska [Sat, 25 May 2019 21:20:21 +0000 (23:20 +0200)] 
archive_write_disk_posix: simplify set_mode()

Try fchmod() first when setting mode on links

4 years agoMerge pull request #1205 from vapier/master
Martin Matuška [Thu, 23 May 2019 13:20:01 +0000 (15:20 +0200)] 
Merge pull request #1205 from vapier/master

simplify gitignore a bit

4 years agosimplify gitignore a bit 1205/head
Mike Frysinger [Wed, 22 May 2019 04:04:35 +0000 (09:49 +0545)] 
simplify gitignore a bit

Lets ignore autotool generated files (.la .dirstamp .deps) everywhere
rather than hardcoded specific subdirs.  We'll never add files with
those names to the source repo, so that should be OK.

We're already ignoring CMakeFiles/ everywhere (since the rule lacks
a leading / anchor), so we can delete the redundant paths.

Rather than hardcode every possible unittest and related files, add
globs that ignore all *_test related paths in the topdir.  We won't
be adding paths like that to the source repo, so it should be OK.

4 years agoMerge pull request #1202 from bradking/rename-b64-encode
Martin Matuška [Tue, 21 May 2019 14:39:21 +0000 (16:39 +0200)] 
Merge pull request #1202 from bradking/rename-b64-encode

b64encode: avoid name conflict with Solaris built-in function

4 years agob64encode: avoid name conflict with Solaris built-in function 1202/head
Brad King [Tue, 21 May 2019 11:43:39 +0000 (07:43 -0400)] 
b64encode: avoid name conflict with Solaris built-in function

Solaris 11.4 has a built-in function named `b64_encode`.  Add a
`la_` prefix to our internal function to avoid conflict.

4 years agocontrib/archivetest: report archive_error_string() on error
Martin Matuska [Mon, 20 May 2019 11:24:59 +0000 (13:24 +0200)] 
contrib/archivetest: report archive_error_string() on error

4 years agoarchive_read_support_format_zip.c: wrap to 80 chars per line (where possible)
Martin Matuska [Mon, 20 May 2019 09:54:19 +0000 (11:54 +0200)] 
archive_read_support_format_zip.c: wrap to 80 chars per line (where possible)

4 years agoMerge pull request #1201 from vapier/master
Martin Matuška [Sun, 19 May 2019 20:23:09 +0000 (22:23 +0200)] 
Merge pull request #1201 from vapier/master

zip: check filename crc in Info-ZIP Unicode Path Extra Field

5 years agoMerge pull request #1074 from ice799/consume_padding
Martin Matuška [Sat, 18 May 2019 21:49:56 +0000 (23:49 +0200)] 
Merge pull request #1074 from ice799/consume_padding

Handle ZIP files with trailing 0s in the extra fields

TODO: test

Fixes #1114
Fixes #1056

5 years agoMerge pull request #1109 from kientzle/Issue1055
Martin Matuška [Sat, 18 May 2019 21:07:38 +0000 (23:07 +0200)] 
Merge pull request #1109 from kientzle/Issue1055

Issue #1055: Ignore padding in Zip extra field data

5 years agotar reader: treat empty archives with a GNU volume header as valid
Martin Matuska [Sat, 18 May 2019 08:19:19 +0000 (10:19 +0200)] 
tar reader: treat empty archives with a GNU volume header as valid

Fixes #1062

5 years agozip: check filename crc in Info-ZIP Unicode Path Extra Field 1201/head
Mike Frysinger [Fri, 17 May 2019 10:53:18 +0000 (22:53 +1200)] 
zip: check filename crc in Info-ZIP Unicode Path Extra Field

The 0x7075 extension includes a crc of the filename that's in the CDE
to make sure that the UTF8 string is always up to date.  If an older
tool updates the CDE but doesn't update the 0x7075 field, we want to
ignore the UTF8 string since it's stale.

5 years agocontrib/archivetest: add help, support stdin, quiet mode and data skip mode
Martin Matuska [Fri, 17 May 2019 10:02:40 +0000 (12:02 +0200)] 
contrib/archivetest: add help, support stdin, quiet mode and data skip mode

5 years agoAdd contrib/archivetest.c utility to test archives with libarchive
Martin Matuska [Thu, 16 May 2019 12:59:04 +0000 (14:59 +0200)] 
Add contrib/archivetest.c utility to test archives with libarchive

5 years agoXar reader: do not try to add xattrs without an allocated name
Martin Matuska [Thu, 16 May 2019 11:48:01 +0000 (13:48 +0200)] 
Xar reader: do not try to add xattrs without an allocated name

Fixes #795

5 years agoAdd test_read_format_rar_ppmd_use_after_free.rar.uu to Makefile.am
Martin Matuska [Sun, 12 May 2019 18:32:55 +0000 (20:32 +0200)] 
Add test_read_format_rar_ppmd_use_after_free.rar.uu to Makefile.am

Entry was missing in PR #1199

5 years agoMerge pull request #1199 from antekone/rar_ppmd_use_after_free
Martin Matuska [Sun, 12 May 2019 18:31:02 +0000 (20:31 +0200)] 
Merge pull request #1199 from antekone/rar_ppmd_use_after_free

RAR reader: add a test for fix b8592ecb

5 years agoCI: process return code of "make distcheck"
Martin Matuska [Sun, 12 May 2019 17:47:12 +0000 (19:47 +0200)] 
CI: process return code of "make distcheck"

5 years agoRAR reader: add a test for fix b8592ecb 1199/head
Grzegorz Antoniak [Sun, 12 May 2019 05:41:47 +0000 (07:41 +0200)] 
RAR reader: add a test for fix b8592ecb

This commit adds an OSSFuzz sample and a test for fix from commit
b8592ecb.

5 years agoCI: add install target
Martin Matuska [Sat, 11 May 2019 22:52:23 +0000 (00:52 +0200)] 
CI: add install target

5 years agoCI: increase make command output verbosity
Martin Matuska [Sat, 11 May 2019 19:36:39 +0000 (21:36 +0200)] 
CI: increase make command output verbosity

Add Fedora_29_distcheck task with "make distcheck"
Add support for debug build with address sanitizer
Add missing free to tar/test/test_option_C_mtree.c

5 years agoAdd missing distcheck files to Makefile.am
Martin Matuska [Sat, 11 May 2019 19:25:16 +0000 (21:25 +0200)] 
Add missing distcheck files to Makefile.am

5 years agoMerge pull request #1197 from vapier/master
Martin Matuška [Sat, 11 May 2019 19:03:29 +0000 (21:03 +0200)] 
Merge pull request #1197 from vapier/master

add new raw test file to the distribution

5 years agoRAR reader: fix use after free
Martin Matuska [Sat, 11 May 2019 00:36:53 +0000 (02:36 +0200)] 
RAR reader: fix use after free

If read_data_compressed() returns ARCHIVE_FAILED, the caller is allowed
to continue with next archive headers. We need to set rar->start_new_table
after the ppmd7_context got freed, otherwise it won't be allocated again.

Reported by: OSS-Fuzz issue 2582

5 years agoFree slurpfile in test_read_format_zip_utf8_paths
Martin Matuska [Sat, 11 May 2019 00:19:55 +0000 (02:19 +0200)] 
Free slurpfile in test_read_format_zip_utf8_paths

5 years agoadd new raw test file to the distribution 1197/head
Mike Frysinger [Fri, 10 May 2019 20:14:44 +0000 (08:14 +1200)] 
add new raw test file to the distribution

5 years agoMerge pull request #1196 from antekone/rar5_verify_window_size
Martin Matuška [Fri, 10 May 2019 19:53:27 +0000 (21:53 +0200)] 
Merge pull request #1196 from antekone/rar5_verify_window_size

RAR5 reader: fix a potential SIGSEGV on 32-bit builds

5 years agoUnify define for _WIN32 in tests
Martin Matuska [Fri, 10 May 2019 09:43:00 +0000 (11:43 +0200)] 
Unify define for _WIN32 in tests

5 years agoRAR5 reader: set correct mode for readonly directories
Martin Matuska [Thu, 9 May 2019 21:46:22 +0000 (23:46 +0200)] 
RAR5 reader: set correct mode for readonly directories

Fix shadowed declaration in processing fflags

5 years agoRAR5 reader: use textual representation for entry file attributes
Martin Matuska [Thu, 9 May 2019 21:34:17 +0000 (23:34 +0200)] 
RAR5 reader: use textual representation for entry file attributes

Add test_read_format_rar5_fileattr

5 years agoExtend test_entry to test file flags on MacOS and Windows
Martin Matuska [Thu, 9 May 2019 20:15:46 +0000 (22:15 +0200)] 
Extend test_entry to test file flags on MacOS and Windows

5 years agoAdd support for Windows file attributes readonly, hidden and system
Martin Matuska [Wed, 8 May 2019 22:06:46 +0000 (00:06 +0200)] 
Add support for Windows file attributes readonly, hidden and system

5 years agoRAR5 reader: fix a potential SIGSEGV on 32-bit builds 1196/head
Grzegorz Antoniak [Thu, 9 May 2019 05:00:33 +0000 (07:00 +0200)] 
RAR5 reader: fix a potential SIGSEGV on 32-bit builds

The reader was causing a SIGSEGV when the file has been declaring a
specific dictionary size. Dictionary sizes above 0xFFFFFFFF bytes are
overflowing size_t type on 32-bit builds. In case the file has been
declaring dictionary size of 0x100000000 (so, UINT_MAX+1), the
window_size variable effectively contained value of 0. Later, the memory
allocation function was skipping actual allocation of 0 bytes, but still
tried to unpack the data.

This commit limits the dictionary window size buffer to 64MB, so it
always fits in a size_t variable, and disallows a zero dictionary size
for files in the header processing stage.

One unit test had to be modified after this change.

5 years agoRAR5 reader: verify that buffer is initialized in copy_string()
Martin Matuska [Tue, 7 May 2019 22:22:52 +0000 (00:22 +0200)] 
RAR5 reader: verify that buffer is initialized in copy_string()

Fixes broken test_read_format_rar5_invalid_dict_reference on OmniOS

5 years agoFix of MSZIP signature parsing
Alexander Chaikovsky [Sat, 20 Apr 2019 22:17:29 +0000 (01:17 +0300)] 
Fix of MSZIP signature parsing

Fixes #1174

5 years agoFix incompatibility introduced by merging PR #1192
Martin Matuska [Tue, 7 May 2019 13:10:13 +0000 (15:10 +0200)] 
Fix incompatibility introduced by merging PR #1192

Makes test_archive_write_set_format_filter_by_ext_tar_gz pass on OmniOS.

5 years agoFix test for pull request #1180
Martin Matuska [Tue, 7 May 2019 12:30:47 +0000 (14:30 +0200)] 
Fix test for pull request #1180

5 years agoMerge pull request #1180 from vapier/master
Martin Matuska [Tue, 7 May 2019 10:35:48 +0000 (12:35 +0200)] 
Merge pull request #1180 from vapier/master

zip: add support for Info-ZIP Unicode Path Extra Field

5 years agomtree reader: allow only printable ascii characters
Martin Matuska [Mon, 6 May 2019 23:16:12 +0000 (01:16 +0200)] 
mtree reader: allow only printable ascii characters

5 years agoMerge pull request #1191 from DerDakon/cmp0075
Martin Matuška [Mon, 6 May 2019 20:47:47 +0000 (22:47 +0200)] 
Merge pull request #1191 from DerDakon/cmp0075

CMake: fix more CMP0075 errors

5 years agoMerge pull request #1193 from DerDakon/rar-size
Martin Matuška [Mon, 6 May 2019 20:47:04 +0000 (22:47 +0200)] 
Merge pull request #1193 from DerDakon/rar-size

fix format string error when printing RAR5 VERSION field

5 years agofix format string error when printing RAR5 VERSION field 1193/head
Rolf Eike Beer [Sun, 5 May 2019 12:45:12 +0000 (14:45 +0200)] 
fix format string error when printing RAR5 VERSION field

Fixes: 4a94ef4eee112224ae19e05651caad28c7f04751
5 years agoarchive_read_support_format_rar5.c: style fixes
Martin Matuska [Mon, 6 May 2019 14:40:41 +0000 (16:40 +0200)] 
archive_read_support_format_rar5.c: style fixes

Wrap to 80 characters.
Use four spaces where appropriate.

5 years agoMerge pull request #1192 from DerDakon/gzip-sign
Martin Matuška [Mon, 6 May 2019 11:01:25 +0000 (13:01 +0200)] 
Merge pull request #1192 from DerDakon/gzip-sign

fix build with -Werror=sign-compare

5 years agoMerge pull request #1190 from antekone/rar5_ossfuzz_fixes_6
Martin Matuška [Mon, 6 May 2019 11:00:12 +0000 (13:00 +0200)] 
Merge pull request #1190 from antekone/rar5_ossfuzz_fixes_6

 RAR5 reader: don't try to unpack entries marked as directories

5 years agoMerge pull request #1188 from antekone/rar5_formatting_fixes
Martin Matuška [Mon, 6 May 2019 10:59:12 +0000 (12:59 +0200)] 
Merge pull request #1188 from antekone/rar5_formatting_fixes

Converted space indentation to tabs in RAR reader, ZIP reader tests

5 years agoRAR5 reader: don't try to unpack entries marked as directories 1190/head
Grzegorz Antoniak [Sun, 5 May 2019 06:16:03 +0000 (08:16 +0200)] 
RAR5 reader: don't try to unpack entries marked as directories

RAR5 structure contains two places where a file can be marked as a
directory. First place is inside the file_flags field in FILE and
SERVICE base blocks, and the second place is inside file_attributes
bitfield also in the same base blocks.

The first directory flag was used to decide if the reader should
allocate any memory for the dictionary buffer needed to unpack the
files. Because if the file is actually a directory, then there should be
nothing to unpack, so if a file was marked as a directory here, the
reader did not allocate any dictionary buffer.

The second directory flag was used to indicate what file attributes
should be passed to the caller. So this second directory flag was used
as an actual indicator what the caller should do during archive
unpacking: should it treat it as a directory, or should it treat it as a
file.

Because of this situation, it was possible to declare a file as a
directory in the file_flags field, but do not declare it as a directory
in the second field, also adding a compressed stream to the FILE/SERVICE
base block. This situation was leading to a condition where the reader
was trying to use unallocated/already freed memory (because it did not
allocate a new dictionary buffer due to the directory flag set in
file_flags).

This commit fixes it so that the reader will check if it tries to
decompress a FILE/SERVICE block that has been declared as a directory in
the file_flags field. If the check will evaluate to true, it will return
an ARCHIVE_FAILED code, because it's not a valid action to take, and
shouldn't exist in valid archives at all.

Also added a unit test for this issue.

This should fix OSSFuzz issue #14574.

This commit also has influenced some of the other unit tests, because it
turned out the sample files used in other tests also did have
inconsistent directory flags in the file_flags and file_attributes
fields. So, some assertions in affected test cases have been changed to
be more relaxed, but still functional.

5 years agofix build with -Werror=sign-compare 1192/head
Rolf Eike Beer [Sun, 5 May 2019 09:31:51 +0000 (11:31 +0200)] 
fix build with -Werror=sign-compare

Fixes: d91ef58185a2f7fa469a0391a6787b60e5b767c9
5 years agoCMake: fix more CMP0075 errors 1191/head
Rolf Eike Beer [Sun, 5 May 2019 09:07:20 +0000 (11:07 +0200)] 
CMake: fix more CMP0075 errors

Building with CMake 3.12 or newer would warn during configuration otherwise.

5 years agoMerge pull request #1189 from antekone/bug_memleak_test_read_format_raw
Martin Matuška [Sun, 5 May 2019 06:06:23 +0000 (08:06 +0200)] 
Merge pull request #1189 from antekone/bug_memleak_test_read_format_raw

Fixed memory leak in test_read_format_raw

5 years agoFixed memory leak in test_read_format_raw 1189/head
Grzegorz Antoniak [Sun, 5 May 2019 05:05:10 +0000 (07:05 +0200)] 
Fixed memory leak in test_read_format_raw

This commit fixes the memory leak introduced by accident in 0debf359.

5 years agoConverted space indentation to tabs in RAR reader, ZIP reader tests 1188/head
Grzegorz Antoniak [Sat, 4 May 2019 06:02:50 +0000 (08:02 +0200)] 
Converted space indentation to tabs in RAR reader, ZIP reader tests

Whole libarchive uses tab characters to indent scopes. RAR5 reader and
RAR5 reader tests were using space characters for indentation.
Additionally ZIP reader tests was using space indentation only in
specific places, but most of the file used tab character for indent.

This commit converts space indentation characters to tabs.

It does not change anything in logic.

5 years agoMerge pull request #1187 from antekone/rar5_ossfuzz_fixes_5
Martin Matuška [Sat, 4 May 2019 22:38:45 +0000 (00:38 +0200)] 
Merge pull request #1187 from antekone/rar5_ossfuzz_fixes_5

RAR5 reader: fix integer overflow

5 years agoMerge branch 'master' into Issue1055 1109/head
Tim Kientzle [Sat, 4 May 2019 18:46:33 +0000 (11:46 -0700)] 
Merge branch 'master' into Issue1055

5 years agoRAR5 reader: fix integer overflow 1187/head
Grzegorz Antoniak [Sat, 4 May 2019 04:54:07 +0000 (06:54 +0200)] 
RAR5 reader: fix integer overflow

This commit fixes an integer overflow triggering on invalid files during
decompression.

Also added a unit test.

Should fix OSSFuzz issue #14555.

5 years agoMerge pull request #1186 from antekone/rar5_ossfuzz_fixes_3
Martin Matuska [Fri, 3 May 2019 10:18:09 +0000 (12:18 +0200)] 
Merge pull request #1186 from antekone/rar5_ossfuzz_fixes_3

RAR5 reader: fix invalid type used for dictionary size mask.

5 years agoMerge branch 'master' into rar5_ossfuzz_fixes_3 1186/head
Martin Matuška [Fri, 3 May 2019 10:07:11 +0000 (12:07 +0200)] 
Merge branch 'master' into rar5_ossfuzz_fixes_3

5 years agoMerge pull request #1172 from antekone/bug/invalid_window_read
Martin Matuška [Fri, 3 May 2019 09:59:38 +0000 (11:59 +0200)] 
Merge pull request #1172 from antekone/bug/invalid_window_read

RAR5 reader: invalid window buffer read in E8E9 filter

5 years agoRAR5: extract files and directories from Windows archives with correct mode
Martin Matuska [Fri, 3 May 2019 08:48:28 +0000 (10:48 +0200)] 
RAR5: extract files and directories from Windows archives with correct mode

Unrar assumes mode 0755 for directories, 0644 for files and 0444 for
read-only files.

5 years agoRAR5 reader: fix invalid type used for dictionary size mask.
Grzegorz Antoniak [Fri, 3 May 2019 06:31:28 +0000 (08:31 +0200)] 
RAR5 reader: fix invalid type used for dictionary size mask.

This commit fixes places where the window_mask variable, which is needed
to perform operations on the dictionary circular buffer, was casted to
an int variable.

In files that declare dictionary buffer size of 4GB, window_mask has a
value of 0xFFFFFFFF. If this value will be assigned to an int variable,
this will effectively make the variable to contain value of -1. This
means, that any cast to a 64-bit value will bit-extend the int variable
to 0xFFFFFFFFFFFFFFFF. This was happening during a read operation from
the dictionary. Such invalid window_mask variable was not guarding
against buffer underflow.

This commit should fix the OSSFuzz issue #14537.

The commit also contains a test case for this issue.

5 years agoMerge pull request #1184 from antekone/rar5_ossfuzz_fixes_2
Martin Matuška [Thu, 2 May 2019 23:10:35 +0000 (01:10 +0200)] 
Merge pull request #1184 from antekone/rar5_ossfuzz_fixes_2

RAR5 reader: fix three OSSFuzz issues

5 years agoRAR5 reader: handle a case with truncated huffman tables. 1184/head
Grzegorz Antoniak [Wed, 1 May 2019 05:32:58 +0000 (07:32 +0200)] 
RAR5 reader: handle a case with truncated huffman tables.

RAR5 reader did assume that the block contains full huffman table data.
In invalid files that declare existence of huffman tables, but also
declare too small block size to fit the huffman tables in, RAR5 reader
was interpreting memory beyond the allocated block.

The commit adds necessary buffer overflow checks and fails the huffman
table reading function in case truncated data will be detected.

The commit also provides a unit test for this case.

Should fix OSSFuzz issue #12817.

5 years agoRAR5 reader: fix bad shift-left operations.
Grzegorz Antoniak [Wed, 1 May 2019 04:47:31 +0000 (06:47 +0200)] 
RAR5 reader: fix bad shift-left operations.

This commit fixes some undefined shift-left operations on types that do
not support such a big shift. Those invalid shift operations were
triggering on invalid files produced by fuzzing.

The commit also contains two unit tests that ensure such problems won't
arise in the future.

Fixes OSSFuzz cases #14490 and #14491.

5 years agoRAR5 reader: fix buffer overflow when parsing huffman tables.
Grzegorz Antoniak [Wed, 1 May 2019 04:21:58 +0000 (06:21 +0200)] 
RAR5 reader: fix buffer overflow when parsing huffman tables.

RAR5 compresses its Huffman tables by using an algorithm similar to Run
Length Encoding. During uncompression of those tables, RAR5 reader
didn't perform enough checks to prevent from buffer overflow in some
cases.

This commit adds additional check that prevents from encountering a
buffer overflow error in some files.

The commit also adds a unit test to guard against regression of this
issue.

Fixes OSSFuzz case #12466.

5 years agoMerge pull request #1183 from antekone/zipx_ossfuzz_issue_14470
Martin Matuška [Mon, 29 Apr 2019 21:01:41 +0000 (23:01 +0200)] 
Merge pull request #1183 from antekone/zipx_ossfuzz_issue_14470

ZIP reader: fix memory leak when unpacking LZMA

5 years agoMerge pull request #1182 from antekone/rar5_support_unknown_entries
Martin Matuška [Mon, 29 Apr 2019 21:01:13 +0000 (23:01 +0200)] 
Merge pull request #1182 from antekone/rar5_support_unknown_entries

RAR5 reader: add support for 'version' field and ignore unknown fields

5 years agoZIP reader: fix memory leak when unpacking LZMA 1183/head
Grzegorz Antoniak [Mon, 29 Apr 2019 04:37:44 +0000 (06:37 +0200)] 
ZIP reader: fix memory leak when unpacking LZMA

This commit fixes a memory leak which is triggered by invalid files.
Sample test case that triggers the leak is provided by OSSFuzz #14470.

If the ZIPX file contanis an LZMA stream, and this stream is invalid,
the reader was allocating an LZMA decoding context which wasn't freed.
Later, when trying to unpack another LZMA stream, context was
re-initialized by allocating a new context and overwriting old pointers
to an unfreed memory, causing a memory leak.

After applying this commit, the LZMA stream context initialization
function will check if there is an non-freed previous context being in
use. If it exists, the reader will free the memory before allocating a
new LZMA unpacking context.

The commit also contains a test case with OSSFuzz sample #14470.

5 years agoRAR5 reader: add support for 'version' extra field and ignore unknown fields. 1182/head
Grzegorz Antoniak [Fri, 26 Apr 2019 04:54:56 +0000 (06:54 +0200)] 
RAR5 reader: add support for 'version' extra field and ignore unknown fields.

This commit adds support for the VERSION extra field appended to FILE
base block. This field allows to add version support for files inside
the archive. If the file name is 'abc' and its version is 15, libarchive
will unpack this file as 'abc;15'. Changing of file names is needed
because there can be multiple files inside the archive with the same
names and different versions. In order for the user to not be confused
which file is which, RAR5 reader changes the name.

Also this commit contains a unit test for VERSION extra field support.

Another change this commit introduces is ignoring of unknown extra
fields. Before applying the commit, RAR5 reader was failing to unpack
the file if an unknown field was encountered. But since the reader knows
the unknown field's size, it can skip it and ignore it, then proceed
with parsing the structure. After applying this commit, RAR5 reader will
skip and ignore unknown fields.

Unknown fields that are skipped include fields in FILE's extra header,
as well as unsupported REDIR types.

5 years agoCI: don't use Dockerfile with MinGW and Cygwin for now (performance)
Martin Matuska [Thu, 25 Apr 2019 23:23:52 +0000 (01:23 +0200)] 
CI: don't use Dockerfile with MinGW and Cygwin for now (performance)

5 years agozip: add support for Info-ZIP Unicode Path Extra Field 1180/head
Tomasz Mikolajewski [Mon, 10 Nov 2014 07:29:53 +0000 (16:29 +0900)] 
zip: add support for Info-ZIP Unicode Path Extra Field

The zip specification supports storing path names in UTF-8 encoding
via the Info-ZIP Unicode Path Extra Field (0x7075).

5 years agoFeed at most UINT_MAX data to gzip.
Ed Catmur [Thu, 25 Apr 2019 19:55:40 +0000 (21:55 +0200)] 
Feed at most UINT_MAX data to gzip.

Fixes #1169

5 years agoMerge pull request #1181 from antekone/rar5_ossfuzz_fixes
Martin Matuška [Thu, 25 Apr 2019 05:57:40 +0000 (07:57 +0200)] 
Merge pull request #1181 from antekone/rar5_ossfuzz_fixes

RAR5 reader: fix ASan errors, fix OSSFuzz samples, add a unit test

5 years agoRAR5 reader: fix ASan errors, fix OSSFuzz samples, add a unit test 1181/head
Grzegorz Antoniak [Tue, 23 Apr 2019 05:23:43 +0000 (07:23 +0200)] 
RAR5 reader: fix ASan errors, fix OSSFuzz samples, add a unit test

This commit fixes errors reported by ASan, as well as fixes runtime
behavior of RAR5 reader on OSSFuzz sample files:

    #12999, #13029, #13144, #13478, #13490

Root cause for these changes is that merge_block() function was
sometimes called in a recursive way. But this function shouldn't be used
this way, because calling it recursively overwrites the global state
that is used by the function. So, the commit ensures the function will
not be called recursively.

There is also one fix that changes some tabs to spaces, because whole
file originally used space indentation.

5 years agoMerge pull request #1177 from vapier/master
Martin Matuška [Tue, 23 Apr 2019 20:01:08 +0000 (22:01 +0200)] 
Merge pull request #1177 from vapier/master

fix memory leak with repeated header reads

5 years agofix memory leak with repeated header reads 1177/head
Mike Frysinger [Tue, 23 Apr 2019 14:32:11 +0000 (00:32 +1000)] 
fix memory leak with repeated header reads

Make sure the name field is reset/cleared when re-reading the header.

Closes #1176.

5 years agoMerge pull request #958 from vapier/master
Tim Kientzle [Mon, 22 Apr 2019 03:25:57 +0000 (20:25 -0700)] 
Merge pull request #958 from vapier/master

support reading metadata from compressed files

In particular, this allows gzip + raw to return the filename stored in the gzip header rather than "data"

5 years agosupport reading metadata from compressed files 958/head
Mike Frysinger [Mon, 27 Mar 2017 00:29:34 +0000 (20:29 -0400)] 
support reading metadata from compressed files

The raw format provides very little metadata.  Allow filters to pass
back state that it knows about.  With gzip, we know the original file
name, mtime, and file size.  For now, we only pull out the first two
as those are available in the file header.  The latter is in the file
trailer, so we'll have to add support for that later (if we can seek
the input).

5 years agoFix typo in preprocessor macro in archive_read_format_zip_cleanup()
Martin Matuska [Sat, 20 Apr 2019 22:53:02 +0000 (00:53 +0200)] 
Fix typo in preprocessor macro in archive_read_format_zip_cleanup()

Frees lzma_stream on cleanup()

Fixes #1165

5 years agoRAR5 reader: use unsigned int for volume number and check for range
Martin Matuska [Sat, 20 Apr 2019 10:12:28 +0000 (12:12 +0200)] 
RAR5 reader: use unsigned int for volume number and check for range

Fix an possible integer overflow.

Reported by: OSS-Fuzz issue 13965

5 years agoUse Dockerfiles for Windows and Linux test environments
Martin Matuska [Thu, 18 Apr 2019 19:54:51 +0000 (21:54 +0200)] 
Use Dockerfiles for Windows and Linux test environments

5 years agoRAR5 reader: fix maximum owner name length
Martin Matuska [Sat, 20 Apr 2019 08:27:46 +0000 (10:27 +0200)] 
RAR5 reader: fix maximum owner name length

Reported by: OSS-Fuzz issue 14331

5 years agoRAR5 reader: change constant ARCHIVE_FORMAT_RAR_V5 to 0x100000
Martin Matuska [Thu, 18 Apr 2019 13:28:49 +0000 (15:28 +0200)] 
RAR5 reader: change constant ARCHIVE_FORMAT_RAR_V5 to 0x100000

Rar5 is implemented as an individual format and not a variant of rar

Makes the following functions usable with ARCHIVE_FORMAT_RAR_V5:
archive_read_set_format()
archive_read_support_format_by_code()

5 years agoRAR5 reader: fix last commit - use read_var() and fix casts
Martin Matuska [Thu, 18 Apr 2019 09:50:35 +0000 (11:50 +0200)] 
RAR5 reader: fix last commit - use read_var() and fix casts

5 years agoRAR5 reader: add support for symlinks, hardlinks, owner and group data
Martin Matuska [Wed, 17 Apr 2019 16:52:27 +0000 (18:52 +0200)] 
RAR5 reader: add support for symlinks, hardlinks, owner and group data

Add missing test archives to Makefile.am

5 years agoUnbreak debug build on Windows/MinGW
Martin Matuska [Wed, 17 Apr 2019 09:45:35 +0000 (11:45 +0200)] 
Unbreak debug build on Windows/MinGW

5 years agoRAR5 reader: invalid window buffer read in E8E9 filter 1172/head
Grzegorz Antoniak [Sat, 2 Feb 2019 07:46:24 +0000 (08:46 +0100)] 
RAR5 reader: invalid window buffer read in E8E9 filter

The E8E9 filter was accessing the window buffer with a direct memory
read. But since the window buffer is a circular buffer, some of its data
can span between the end of the buffer and beginning of the buffer. This
means that accessing the window buffer needs to be done always by a
reading function that is aware of the fact that the window buffer is
circular.

The commit changes direct memory read to the access through the
circular_memcpy() function.

This fixes some edge cases when the E8E9 filter data (4 bytes) is
spanned between the end of the window buffer and the beginning of the
buffer. This situation can happen in archives compressed with a small
dictionary size.

5 years agoUpdate NEWS
Martin Matuska [Tue, 16 Apr 2019 22:12:49 +0000 (00:12 +0200)] 
Update NEWS