]> git.ipfire.org Git - thirdparty/libarchive.git/log
thirdparty/libarchive.git
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 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 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 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 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

5 years agotar/test_option_n: fix build and operation on Windows
Martin Matuska [Tue, 16 Apr 2019 13:49:16 +0000 (15:49 +0200)] 
tar/test_option_n: fix build and operation on Windows

5 years agoMerge pull request #812 from pohly/non-recursive-read
Martin Matuska [Tue, 16 Apr 2019 13:42:36 +0000 (15:42 +0200)] 
Merge pull request #812 from pohly/non-recursive-read

Support non-recursive operation in extract and list modes

5 years agotest_option_n.c: cover non-recursive extract/list 812/head
Patrick Ohly [Mon, 24 Oct 2016 11:10:48 +0000 (13:10 +0200)] 
test_option_n.c: cover non-recursive extract/list

Testing uses only listing because extraction uses the same code
paths. Indirectly this covers also the new API call.

Some corner cases get special attention:
- archive where a file in a directory is present without the
  directory
- the error when asking to extract a directory which is not
  present

5 years agoWindows symlinks: new functions and extended tar header
Martin Matuska [Sun, 14 Apr 2019 23:50:29 +0000 (01:50 +0200)] 
Windows symlinks: new functions and extended tar header

New functions:
archive_entry_symlink_type()
archive_entry_set_symlink_type()

Suppoted value constants:
AE_SYMLINK_TYPE_UNDEFINED
AE_SYMLINK_TYPE_FILE
AE_SYMLINK_TYPE_DIRECTORY

New extended tar header:
LIBARCHIVE.symlinktype

The function archive_entry_symlink_type() retrieves and the function
archive_entry_set_symlink_type() sets the symbolic link type of an archive
entry. The information about the symbolic link type is required to properly
restore symbolic links on Microsoft Windows. If the symlink type is set
to AE_SYMLINK_TYPE_FILE or AE_SYMLINK_TYPE_DIRECTORY and a tar archive
is written, an extended tar header LIBARCHIVE.symlinktype is stored with
the value "file" or "dir". When reading symbolic links on Windows, the
link type is automatically stored in the archive_entry structure.

On unix systems, the symlink type has no effect when reading or writing
symbolic links.

5 years agonon-recursive extract and list
Patrick Ohly [Mon, 24 Oct 2016 10:54:48 +0000 (12:54 +0200)] 
non-recursive extract and list

Sometimes it makes sense to extract or list a directory contained in
an archive without also doing the same for the content of the
directory, i.e. allowing -n (= --no-recursion) in combination with the
x and t modes.

bsdtar uses the match functionality in libarchive to track include
matches. A new libarchive API call
archive_match_set_inclusion_recursion() gets introduced to
influence the matching behavior, with the default behavior as before.

Non-recursive matching can be achieved by anchoring the path match at
both start and end. Asking for a directory which itself isn't in the
archive when in non-recursive mode is an error and handled by the
existing mechanism for tracking unused inclusion entries.

5 years agotar: add option --exclude-vcs
Martin Matuska [Sat, 13 Apr 2019 22:02:31 +0000 (00:02 +0200)] 
tar: add option --exclude-vcs

Fixes #999

5 years agoWindows symlink bugfixes and improvements
Martin Matuska [Sat, 13 Apr 2019 19:51:03 +0000 (21:51 +0200)] 
Windows symlink bugfixes and improvements

Treat targets ending with /. and /.. as directory symlinks
Explicitly test for file and directory symlinks
Improve debug output on test failure
Fix two memory allocations

5 years agoCirrus CI: use mojave-xcode-10.2 image for macOS
Martin Matuska [Fri, 12 Apr 2019 20:41:32 +0000 (22:41 +0200)] 
Cirrus CI: use mojave-xcode-10.2 image for macOS

5 years agoUnbreak sparse file tests on the APFS file system
Martin Matuska [Fri, 12 Apr 2019 15:22:11 +0000 (17:22 +0200)] 
Unbreak sparse file tests on the APFS file system

The hole size needs to be at least 4097*4096 bytes.
Fixes #1123

5 years agoMultiple Windows-related CI changes
Martin Matuska [Sun, 7 Apr 2019 09:10:56 +0000 (11:10 +0200)] 
Multiple Windows-related CI changes

Add MSVC and Cygwin builds with Cirrus CI (no tests yet)
Remove Travis CI build

TODO: failing UTF8 tests with MSVC still need fixing

5 years agoCI: allow to skip sparse and fuzz tests
Martin Matuska [Sun, 7 Apr 2019 07:50:20 +0000 (09:50 +0200)] 
CI: allow to skip sparse and fuzz tests

Sparse tests don't work in a Windows container

5 years agoFix remaining MinGW tests
Martin Matuska [Sat, 6 Apr 2019 23:54:42 +0000 (01:54 +0200)] 
Fix remaining MinGW tests
Enable tests on MinGW CI builds

5 years agoarchive_read_support_format_xar: initialize some variables
Martin Matuska [Sun, 7 Apr 2019 00:12:03 +0000 (02:12 +0200)] 
archive_read_support_format_xar: initialize some variables

5 years agoSkip appropriate zip tests if bzip2 or lzma is not compiled in
Martin Matuska [Sat, 6 Apr 2019 19:29:47 +0000 (21:29 +0200)] 
Skip appropriate zip tests if bzip2 or lzma is not compiled in

5 years agoMerge pull request #1076 from uckelman-sf/fix_undef_stat
Martin Matuška [Sat, 6 Apr 2019 17:15:32 +0000 (19:15 +0200)] 
Merge pull request #1076 from uckelman-sf/fix_undef_stat

Windows compatibility: don't #undef stat and #define stat().

5 years agoFix handling of strtol() and strtoul()
Martin Matuska [Thu, 4 Apr 2019 22:21:32 +0000 (00:21 +0200)] 
Fix handling of strtol() and strtoul()

Fixes #1168

5 years agoAdd Windows symlink support to NEWS
Martin Matuska [Thu, 4 Apr 2019 15:15:51 +0000 (17:15 +0200)] 
Add Windows symlink support to NEWS

5 years agoFix various symlink bugs with Windows symlinks
Martin Matuska [Wed, 3 Apr 2019 21:13:35 +0000 (23:13 +0200)] 
Fix various symlink bugs with Windows symlinks
tests: extend assertMakeSymlink with targetIsDir

5 years agoCirrus CI: add Cygwin build, MinGW build use zlib, suppress download progress
Martin Matuska [Mon, 1 Apr 2019 12:00:42 +0000 (14:00 +0200)] 
Cirrus CI: add Cygwin build, MinGW build use zlib, suppress download progress

5 years agoExtend unreadable directory code to Linux (O_PATH) and SunOS (O_SEARCH)
Martin Matuska [Sun, 31 Mar 2019 10:43:26 +0000 (12:43 +0200)] 
Extend unreadable directory code to Linux (O_PATH) and SunOS (O_SEARCH)

5 years agoCirrus CI: Add MinGW and split into stages
Martin Matuska [Sat, 30 Mar 2019 21:40:03 +0000 (22:40 +0100)] 
Cirrus CI: Add MinGW and split into stages

5 years agoMerge pull request #1167 from RhodiumToad/parent_fixes
Martin Matuška [Sat, 30 Mar 2019 19:36:50 +0000 (20:36 +0100)] 
Merge pull request #1167 from RhodiumToad/parent_fixes

Fix bugs related to unreadable directories.

5 years agoUpdate tests for platforms on which success is impossible. 1167/head
Andrew Gierth [Sat, 30 Mar 2019 15:01:41 +0000 (15:01 +0000)] 
Update tests for platforms on which success is impossible.

If a platform lacks O_EXEC and we get a failure when starting the
traverse from within an unreadable directory, then don't score that as
a failure, since with the current code it can never succeed. But if
O_EXEC exists, the failure still counts.

5 years agoCirrus CI - support existing homebrew packages
Martin Matuska [Sat, 30 Mar 2019 00:26:26 +0000 (01:26 +0100)] 
Cirrus CI - support existing homebrew packages

5 years agoFix bugs related to unreadable directories.
Andrew Gierth [Fri, 29 Mar 2019 08:22:46 +0000 (08:22 +0000)] 
Fix bugs related to unreadable directories.

1. Don't try to open ".." for reading as part of the process of
ascending out of an initially specified directory; it's wrong, and if
the directory is not readable it causes a spurious error.

2. If opening "." initially for reading fails, then open it for
execute instead, if O_EXEC exists. This avoids spurious and unhelpful
failures when the current directory is not readable.

Add test cases for the above.

At least the first of these issues is ancient; it was reported against
FreeBSD in 2014.

5 years agoAdd support for directory symlinks on Windows
Martin Matuska [Wed, 27 Mar 2019 15:22:41 +0000 (16:22 +0100)] 
Add support for directory symlinks on Windows

Symlinks with the targets ".", ".." or with an ending slash in the
target are treated as directory symlinks on Windows.

5 years agoAdd basic read and write support for symbolic links on Windows
Martin Matuska [Tue, 26 Mar 2019 16:56:30 +0000 (17:56 +0100)] 
Add basic read and write support for symbolic links on Windows

TODO: proper handling of directory symlinks

Fixes #1030

5 years agoarchive_entry.c: changes in file flags code
Martin Matuska [Tue, 19 Mar 2019 16:17:51 +0000 (17:17 +0100)] 
archive_entry.c: changes in file flags code
Use "undel" for FS_UNRM_FL file flag
Drop compat of UF_NOUNLINK and FS_UNRM_FL
Use "secdel" for FS_SECRM_FL and "journal-data" for FS_JOURNAL_DATA_FL

Fixes #1098

5 years agolibarchive/archive_entry.c: fix typo in comment
Martin Matuska [Tue, 19 Mar 2019 12:48:38 +0000 (13:48 +0100)] 
libarchive/archive_entry.c: fix typo in comment

5 years agoarchive_write_disk_posix: constantify file flag masks
Martin Matuska [Mon, 18 Mar 2019 22:07:41 +0000 (23:07 +0100)] 
archive_write_disk_posix: constantify file flag masks

5 years agoarchive_entry.c: alphabetically sort FreeBSD/MacOS file flags in comment
Martin Matuska [Thu, 14 Mar 2019 22:04:08 +0000 (23:04 +0100)] 
archive_entry.c: alphabetically sort FreeBSD/MacOS file flags in comment

5 years agoIf not root do not try to restore SF_* file flags on FreeBSD and Mac OS
Martin Matuska [Thu, 14 Mar 2019 21:52:39 +0000 (22:52 +0100)] 
If not root do not try to restore SF_* file flags on FreeBSD and Mac OS

5 years agoRemove FS_EXTEND_FL from Linux and UF_ARCHIVE from FreeBSD file flags
Martin Matuska [Wed, 13 Mar 2019 14:57:21 +0000 (15:57 +0100)] 
Remove FS_EXTEND_FL from Linux and UF_ARCHIVE from FreeBSD file flags

As to documentation, FS_EXTEND_FL may not be removed using chattr(1)
UF_ARCHIVE is used internally on FreeBSD ZFS

5 years agoImprove and document file flag and file attribute support
Martin Matuska [Tue, 12 Mar 2019 22:11:45 +0000 (23:11 +0100)] 
Improve and document file flag and file attribute support

Removed read-only FreeBSD fflags: snapshot

Removed read-only Linux file attributes:
FS_BTREE_FL, FS_ECOMPR_FL, FS_DIRTY_FL, FS_COMPRBLK_FL, FS_INDEX_FL,
FS_IMAGIC_FL, FS_ENCRYPT_FL, FS_HUGE_FILE_FL, FS_EA_INODE_FL,
FS_EOFBLOCKS_FL, FS_INLINE_DATA_FL

Add missing FreeBSD fflags: uarch, offline, rdonly, sparse, reparse, system

Document in code supported file flags and their mapping

5 years agoMerge pull request #1083 from guischulz/windows_unc_workdir
Martin Matuška [Sun, 10 Mar 2019 21:36:25 +0000 (22:36 +0100)] 
Merge pull request #1083 from guischulz/windows_unc_workdir

Fix full-pathname for extraction with UNC working directory on Windows

5 years agoMerge pull request #1043 from jstarks/utf8
Martin Matuška [Sun, 10 Mar 2019 21:23:05 +0000 (22:23 +0100)] 
Merge pull request #1043 from jstarks/utf8

windows: Support UTF-8 locale

5 years agoMerge pull request #1101 from jcfr/fix-cmake-warning-set-cmp0074
Martin Matuška [Sun, 10 Mar 2019 20:47:50 +0000 (21:47 +0100)] 
Merge pull request #1101 from jcfr/fix-cmake-warning-set-cmp0074

cmake: Set CMP0074 to NEW

5 years agoMerge pull request #1033 from mellery451/werror-optional
Martin Matuška [Sun, 10 Mar 2019 20:45:25 +0000 (21:45 +0100)] 
Merge pull request #1033 from mellery451/werror-optional

CMake: make warning-as-error optional, but retain current defaults

5 years agoMerge pull request #1157 from praiskup/fix-make-dist
Martin Matuška [Sun, 10 Mar 2019 20:40:34 +0000 (21:40 +0100)] 
Merge pull request #1157 from praiskup/fix-make-dist

Fix 'make dist' to include blake2 headers

5 years agoFix 'make dist' to include blake2 headers 1157/head
Pavel Raiskup [Fri, 8 Mar 2019 07:33:36 +0000 (08:33 +0100)] 
Fix 'make dist' to include blake2 headers

Fixes #1157

5 years agoUnderstand "journal-data", "secdel" and "undel" fflags in star tar archives
Martin Matuska [Wed, 6 Mar 2019 23:37:19 +0000 (00:37 +0100)] 
Understand "journal-data", "secdel" and "undel" fflags in star tar archives

Issue #1098

5 years agoarchive_entry.c: replace spaces with tabs, understand nouunlnk on Linux
Martin Matuska [Wed, 6 Mar 2019 22:53:21 +0000 (23:53 +0100)] 
archive_entry.c: replace spaces with tabs, understand nouunlnk on Linux

5 years agoarchive_write_disk_posix: processes with CAP_CHOWN may change file owner
Martin Matuska [Mon, 4 Mar 2019 13:58:06 +0000 (14:58 +0100)] 
archive_write_disk_posix: processes with CAP_CHOWN may change file owner

Fixes #1144

5 years agoarchive_read_disk_entry_from_file(): check for ARCHIVE_READ_DISK magic
Martin Matuska [Sun, 3 Mar 2019 23:10:37 +0000 (00:10 +0100)] 
archive_read_disk_entry_from_file(): check for ARCHIVE_READ_DISK magic

Fixes #1143

5 years agoMerge pull request #1153 from antekone/bug/zipx_fuzzing_fixes
Martin Matuška [Sun, 3 Mar 2019 22:36:35 +0000 (23:36 +0100)] 
Merge pull request #1153 from antekone/bug/zipx_fuzzing_fixes

ZIP reader: fixed 2 bugs: unlimited loop and a crash, triggered by invalid files

5 years agoZIP reader: fixed an unlimited loop in BZIP2 decompressor. 1153/head
Grzegorz Antoniak [Thu, 28 Feb 2019 06:26:25 +0000 (07:26 +0100)] 
ZIP reader: fixed an unlimited loop in BZIP2 decompressor.

The hang was triggered on invalid zipx files that declare more data than
there actually is in the file.

This case was found by fuzzing the zipx file.

5 years agoZIP reader: fix a crash in PPMd8 decompressor.
Grzegorz Antoniak [Fri, 1 Mar 2019 07:32:00 +0000 (08:32 +0100)] 
ZIP reader: fix a crash in PPMd8 decompressor.

The crash happened on invalid files which declare more data than
actually are stored in the file.

This commit contains a fix that prevents PPMd8 decompressor from
crashing, as well as relevant tests containing files that were
triggering the crash.

5 years agoMerge pull request #1151 from antekone/clean_whitespaces
Martin Matuška [Thu, 28 Feb 2019 09:02:45 +0000 (10:02 +0100)] 
Merge pull request #1151 from antekone/clean_whitespaces

Whitespace reformatting in RAR5 reader, ZIP reader.

5 years agoWhitespace reformatting in RAR5 reader, ZIP reader. 1151/head
Grzegorz Antoniak [Thu, 28 Feb 2019 05:11:41 +0000 (06:11 +0100)] 
Whitespace reformatting in RAR5 reader, ZIP reader.

Changed indent of some lines from tabs to spaces (because the whole file
is using space indenting) in RAR5 reader,

Removed some superfluous space characters from end of some lines in
RAR5 reader and ZIP reader.

5 years agoTravis CI Windows fixes
Martin Matuska [Wed, 27 Feb 2019 21:22:46 +0000 (22:22 +0100)] 
Travis CI Windows fixes
- MS Visual Studio: use cmake's interface to build system
- disable Windows tests (test only the build) due to timeout and fail issues

5 years agoMerge pull request #1150 from antekone/bug/visual_studio_warnings
Martin Matuška [Wed, 27 Feb 2019 21:18:41 +0000 (22:18 +0100)] 
Merge pull request #1150 from antekone/bug/visual_studio_warnings

Removed cast warnings under Visual Studio

5 years agoRemoved cast warnings under Visual Studio 1150/head
Grzegorz Antoniak [Wed, 27 Feb 2019 19:04:45 +0000 (20:04 +0100)] 
Removed cast warnings under Visual Studio

5 years agoAdd MS Visual Studio and MinGW tests via Travis CI
Martin Matuska [Sun, 24 Feb 2019 20:21:26 +0000 (21:21 +0100)] 
Add MS Visual Studio and MinGW tests via Travis CI
Make MS Visual Studio complain less in test_read_format_rar5.c

5 years agoMerge pull request #1133 from BotellaA/master
Martin Matuška [Sun, 24 Feb 2019 20:11:41 +0000 (21:11 +0100)] 
Merge pull request #1133 from BotellaA/master

Remove windows warnings

5 years agoMerge pull request #1146 from ijanos/master
Martin Matuška [Sun, 24 Feb 2019 20:05:56 +0000 (21:05 +0100)] 
Merge pull request #1146 from ijanos/master

enable using libarchive from a submodule

5 years agofix dereferencing null pointer in file_new()
Patrick Cheng [Sun, 24 Feb 2019 19:32:06 +0000 (11:32 -0800)] 
fix dereferencing null pointer in file_new()

file_new() sets file to NULL first.
when file_new() fails, file is set to NULL if it doesn't need to be freed
so, only free when need to. otherwise would deference a null pointer.

Found this from clang's analyzer
Fixes #1140

5 years agoenable using libarchive from a submodule 1145/head 1146/head
János Illés [Wed, 20 Feb 2019 08:59:30 +0000 (09:59 +0100)] 
enable using libarchive from a submodule

5 years agoerror_number sometime is not initialized. (#1141)
Patrick Cheng [Wed, 20 Feb 2019 00:57:47 +0000 (16:57 -0800)] 
error_number sometime is not initialized. (#1141)

clang analyzer flagged this.

in check_symlinks_fsobj, if open() failed, the function exits without
setting a_eno and a_estr.

5 years agocalling strlen() with null pointer (#1142)
Patrick Cheng [Wed, 20 Feb 2019 00:55:19 +0000 (16:55 -0800)] 
calling strlen() with null pointer (#1142)

clang analyzer found this issue.

other archive_mstring_copy_* has the pattern:

```
if (xxx == NULL) {
  aes->aes_set = 0;
  return (0);
}
```

archive_mstring_copy_utf8() didn't follow that pattern, so if NULL is passed in, it will call strlen(NULL).

Noticed that archive_mstring_copy_wcs_len() doesn't follow the pattern either.

Fixes #1142

5 years agoarchive_read_disk_posix.c: initialize delayed_errno
Martin Matuska [Wed, 13 Feb 2019 07:31:28 +0000 (08:31 +0100)] 
archive_read_disk_posix.c: initialize delayed_errno

5 years agoMerge pull request #1134 from elfring/Remove_unnecessary_checks1
Martin Matuška [Tue, 12 Feb 2019 22:01:24 +0000 (23:01 +0100)] 
Merge pull request #1134 from elfring/Remove_unnecessary_checks1

Delete unnecessary checks before some function calls

5 years agoMerge pull request #1135 from HadesD/patch-1
Martin Matuška [Sun, 10 Feb 2019 00:04:57 +0000 (01:04 +0100)] 
Merge pull request #1135 from HadesD/patch-1

Fix find lib lzma

5 years agoPOSIX reader: more next_entry() fixes
Martin Matuska [Sun, 3 Feb 2019 22:47:42 +0000 (23:47 +0100)] 
POSIX reader: more next_entry() fixes

- if not descending, fail if tree_current_lstat() returns ENOENT
- fix the "File removed before we read it" error message if processing multiple files at a time.

Fixes #1082

5 years agoPOSIX reader: do not fail when tree_current_lstat() fails due to ENOENT
Eugene Grossbein [Sat, 2 Feb 2019 00:05:18 +0000 (01:05 +0100)] 
POSIX reader: do not fail when tree_current_lstat() fails due to ENOENT

Fixes #1082