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

6 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

6 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.

6 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"

6 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).

6 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

6 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

6 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

6 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

6 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()

6 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

6 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

6 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

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

6 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

6 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

6 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

6 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.

6 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.

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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().

6 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

6 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

6 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

6 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

6 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)

6 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

6 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.

6 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.

6 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

6 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.

6 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.

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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.

6 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.

6 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.

6 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.

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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.

6 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

6 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

6 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

6 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

6 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

6 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

6 years agoFix find lib lzma 1135/head
Ichiro [Tue, 5 Feb 2019 17:14:09 +0000 (02:14 +0900)] 
Fix find lib lzma

6 years agoBug #1128: Deletion of unnecessary checks before calls of the function “archive_entry... 1134/head
Markus Elfring [Mon, 4 Feb 2019 18:00:32 +0000 (19:00 +0100)] 
Bug #1128: Deletion of unnecessary checks before calls of the function “archive_entry_free”

The function “archive_entry_free” is implemented in the way that only
two functions are called which tolerate the passing of null pointers.
It is therefore not needed that a function caller repeats a corresponding check.

This issue was fixed by using the software “Coccinelle 1.0.7”.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
6 years agoBug #1128: Deletion of unnecessary checks before calls of the function “free”
Markus Elfring [Mon, 4 Feb 2019 17:38:18 +0000 (18:38 +0100)] 
Bug #1128: Deletion of unnecessary checks before calls of the function “free”

The function “free” is documented in the way that no action shall occur for
a passed null pointer. It is therefore not needed that a function caller
repeats a corresponding check.
https://stackoverflow.com/questions/18775608/free-a-null-pointer-anyway-or-check-first

This issue was fixed by using the software “Coccinelle 1.0.7”.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
6 years agoRemove windows warnings 1133/head
Arnadu Botella [Sun, 3 Feb 2019 11:29:05 +0000 (03:29 -0800)] 
Remove windows warnings

6 years agoMerge pull request #1125 from antekone/bug/GH-1119
Martin Matuška [Wed, 30 Jan 2019 23:27:41 +0000 (00:27 +0100)] 
Merge pull request #1125 from antekone/bug/GH-1119

RAR5 reader: fix an invalid read and a memory leak

6 years agoRemove test_compat_pax_libarchive_2x
Martin Matuska [Wed, 30 Jan 2019 16:43:50 +0000 (17:43 +0100)] 
Remove test_compat_pax_libarchive_2x

The is determined for FreeBSD only and it doesn't work since 2015.
There is no significant need to keep this functionality, it may be
deprecated.

6 years agoReorganize CI build scripts
Martin Matuska [Wed, 30 Jan 2019 15:56:37 +0000 (16:56 +0100)] 
Reorganize CI build scripts

6 years agoRemove Travis CI testing
Martin Matuska [Wed, 30 Jan 2019 15:42:38 +0000 (16:42 +0100)] 
Remove Travis CI testing

6 years agoCI build: allow BS as a shortcut for BUILD_SYSTEM variable
Martin Matuska [Tue, 22 Jan 2019 00:50:16 +0000 (01:50 +0100)] 
CI build: allow BS as a shortcut for BUILD_SYSTEM variable

6 years agoCirrus CI: add Fedora 29 container test
Martin Matuska [Sun, 20 Jan 2019 23:12:28 +0000 (00:12 +0100)] 
Cirrus CI: add Fedora 29 container test

6 years agoMerge pull request #1124 from mgorny/zstd
Martin Matuška [Tue, 22 Jan 2019 23:07:00 +0000 (00:07 +0100)] 
Merge pull request #1124 from mgorny/zstd

cmake: Add ENABLE_ZSTD option

6 years agocmake: Add ENABLE_ZSTD option 1124/head
Michał Górny [Tue, 22 Jan 2019 06:52:11 +0000 (07:52 +0100)] 
cmake: Add ENABLE_ZSTD option

6 years agoMerge pull request #1121 from kulikjak/fix_mkdev
Martin Matuška [Sun, 20 Jan 2019 10:32:17 +0000 (11:32 +0100)] 
Merge pull request #1121 from kulikjak/fix_mkdev

Add missing header file include

6 years agoMerge pull request #1110 from antekone/zipx_support_work_3
Martin Matuška [Sun, 20 Jan 2019 10:09:26 +0000 (11:09 +0100)] 
Merge pull request #1110 from antekone/zipx_support_work_3

ZIP reader: added support for XZ, LZMA, PPMD8 and BZIP2 decompression

6 years agoImprove cirrus build
Martin Matuska [Sun, 20 Jan 2019 01:10:53 +0000 (02:10 +0100)] 
Improve cirrus build

6 years agoMerge pull request #1120 from daxtens/fixes2
Martin Matuška [Sun, 20 Jan 2019 00:47:56 +0000 (01:47 +0100)] 
Merge pull request #1120 from daxtens/fixes2

Fix a 7zip crash and a ISO9660 infinite loop

6 years agoMerge pull request #1116 from GeraldNDA/GeraldNDA-support-64bit-ar
Martin Matuška [Sun, 20 Jan 2019 00:22:13 +0000 (01:22 +0100)] 
Merge pull request #1116 from GeraldNDA/GeraldNDA-support-64bit-ar

Add support for the 64-bit ar format

6 years agoRAR5 reader: Removed a memory leak in process_head_file 1125/head
Grzegorz Antoniak [Fri, 18 Jan 2019 06:24:17 +0000 (07:24 +0100)] 
RAR5 reader: Removed a memory leak in process_head_file

The process_head_file function was using memset() to clear the
archive_entry structure. The problem was that this structure could
contain pointers to allocated blocks of memory, and removing those
pointers with memset() resulted in a memory leak.

Switching it in favor of archive_entry_clear() effectively clears the
structure, but also releases any allocated memory blocks. This removes
the memory leak.

The commit also changes the way a temporary archive_entry instance is
being created when skipping a base block after block merge; instead of
directly creating a new instance on the stack, a constructor function
archive_entry_new() is used to ensure the new archive_entry instance is
not in an inconsistent state. This is needed because the fix described
in the first half of this commit message depends on the archive_entry
instance being in a consistent state due to the call of the
archive_entry_clear() function.

6 years agoRAR5 reader: Fixed a read from invalid memory block
Grzegorz Antoniak [Fri, 18 Jan 2019 05:17:19 +0000 (06:17 +0100)] 
RAR5 reader: Fixed a read from invalid memory block

In multi-file RAR5 archives, if a block spans from one file to another,
the RAR5 reader merges both blocks into one, and feeds this merged block
to the decompressor function. The problem is that the block merge
function allocates the exact number of bytes for this block. This is
problematic because when trying to read the last byte from this new
block with bit reader functions, the bit reader functions will reference
few additional bytes right after the byte the caller is trying to read,
resulting in an out of bounds read.

The commit increases the allocation size for new merged block. This
ensures that bit reader functions will never perform any out of bounds
reads. Additional space is zeroed out to prevent errors from
instrumentation tools like ASan or Valgrind.

Fixes #1119

6 years agoAdd missing header file include 1121/head
Jakub Kulík [Wed, 16 Jan 2019 16:19:48 +0000 (17:19 +0100)] 
Add missing header file include

6 years ago7zip: fix crash when parsing certain archives 1120/head
Daniel Axtens [Tue, 1 Jan 2019 05:01:40 +0000 (16:01 +1100)] 
7zip: fix crash when parsing certain archives

Fuzzing with CRCs disabled revealed that a call to get_uncompressed_data()
would sometimes fail to return at least 'minimum' bytes. This can cause
the crc32() invocation in header_bytes to read off into invalid memory.

A specially crafted archive can use this to cause a crash.

An ASAN trace is below, but ASAN is not required - an uninstrumented
binary will also crash.

==7719==ERROR: AddressSanitizer: SEGV on unknown address 0x631000040000 (pc 0x7fbdb3b3ec1d bp 0x7ffe77a51310 sp 0x7ffe77a51150 T0)
==7719==The signal is caused by a READ memory access.
    #0 0x7fbdb3b3ec1c in crc32_z (/lib/x86_64-linux-gnu/libz.so.1+0x2c1c)
    #1 0x84f5eb in header_bytes (/tmp/libarchive/bsdtar+0x84f5eb)
    #2 0x856156 in read_Header (/tmp/libarchive/bsdtar+0x856156)
    #3 0x84e134 in slurp_central_directory (/tmp/libarchive/bsdtar+0x84e134)
    #4 0x849690 in archive_read_format_7zip_read_header (/tmp/libarchive/bsdtar+0x849690)
    #5 0x5713b7 in _archive_read_next_header2 (/tmp/libarchive/bsdtar+0x5713b7)
    #6 0x570e63 in _archive_read_next_header (/tmp/libarchive/bsdtar+0x570e63)
    #7 0x6f08bd in archive_read_next_header (/tmp/libarchive/bsdtar+0x6f08bd)
    #8 0x52373f in read_archive (/tmp/libarchive/bsdtar+0x52373f)
    #9 0x5257be in tar_mode_x (/tmp/libarchive/bsdtar+0x5257be)
    #10 0x51daeb in main (/tmp/libarchive/bsdtar+0x51daeb)
    #11 0x7fbdb27cab96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #12 0x41dd09 in _start (/tmp/libarchive/bsdtar+0x41dd09)

This was primarly done with afl and FairFuzz. Some early corpus entries
may have been generated by qsym.

6 years agoiso9660: Fail when expected Rockridge extensions is missing
Daniel Axtens [Tue, 1 Jan 2019 06:10:49 +0000 (17:10 +1100)] 
iso9660: Fail when expected Rockridge extensions is missing

A corrupted or malicious ISO9660 image can cause read_CE() to loop
forever.

read_CE() calls parse_rockridge(), expecting a Rockridge extension
to be read. However, parse_rockridge() is structured as a while
loop starting with a sanity check, and if the sanity check fails
before the loop has run, the function returns ARCHIVE_OK without
advancing the position in the file. This causes read_CE() to retry
indefinitely.

Make parse_rockridge() return ARCHIVE_WARN if it didn't read an
extension. As someone with no real knowledge of the format, this
seems more apt than ARCHIVE_FATAL, but both the call-sites escalate
it to a fatal error immediately anyway.

Found with a combination of AFL, afl-rb (FairFuzz) and qsym.