Tim Kientzle [Mon, 25 Apr 2016 03:41:12 +0000 (20:41 -0700)]
Default to Windows 7 SDK
Some of our current crypto bindings require the Win7 SDK.
Once we can rework those, this could reasonably be changed
to Win Vista or possibly Win Server 2003.
I'd like to completely remove support for WinXP and earlier.
Tim Kientzle [Mon, 25 Apr 2016 00:13:45 +0000 (17:13 -0700)]
Issue #656: Fix CVE-2016-1541, VU#862384
When reading OS X metadata entries in Zip archives that were stored
without compression, libarchive would use the uncompressed entry size
to allocate a buffer but would use the compressed entry size to limit
the amount of data copied into that buffer. Since the compressed
and uncompressed sizes are provided by data in the archive itself,
an attacker could manipulate these values to write data beyond
the end of the allocated buffer.
This fix provides three new checks to guard against such
manipulation and to make libarchive generally more robust when
handling this type of entry:
1. If an OS X metadata entry is stored without compression,
abort the entire archive if the compressed and uncompressed
data sizes do not match.
2. When sanity-checking the size of an OS X metadata entry,
abort this entry if either the compressed or uncompressed
size is larger than 4MB.
3. When copying data into the allocated buffer, check the copy
size against both the compressed entry size and uncompressed
entry size.
Tim Kientzle [Sun, 24 Apr 2016 22:16:10 +0000 (15:16 -0700)]
Ensure that cryptor, hmac, and xxhash always define at least one symbol. This prevents headaches with compilers and linkers that choke on empty object files.
Tim Kientzle [Sun, 10 Apr 2016 01:10:37 +0000 (18:10 -0700)]
Issue #655: Be more careful verifying sparse file reading
The old logic took a number of shortcuts; this now does a careful
comparison of the template used to generate the file with
the contents read back, verifying that the read blocks reflect
the expected pattern of zero and non-zero bytes and that the
expected number of holes actually appear.
This change introduces support for building on AIX via CMake. `gcc`
warning options are mapped to equivalent options in the `xlc` suite
where possible. The compiler is overridden to be `xlc_r` instead of
`cc` for thread-safe compilation and linking.
Signed-off-by: Eric N. Vander Weele <ericvw@gmail.com>
Tim Kientzle [Sun, 3 Apr 2016 18:03:22 +0000 (11:03 -0700)]
Issue 550: Fix out-of-bounds read in mtree.
The mtree parser scanned from the end of the string to identify
the filename when the filename is the last element of the line.
If the filename was the entire line, the logic would scan back
to before the start of the string.
The revised logic scans from the beginning of the string
and remembers the last separator position to locate the
trailing filename.
Andrew Gregory [Fri, 15 Jan 2016 07:39:41 +0000 (02:39 -0500)]
Skip root directory symlink check
The first time check_symlinks is called on an absolute path it will use
the entry pathname directly, blanking the leading slash. This leads to
calling lstat on an empty string, which returns ENOENT, terminating the
loop early and falsely marking the path as safe.
Andrew Gregory [Fri, 15 Jan 2016 07:40:00 +0000 (02:40 -0500)]
Restore modified path after lstat
check_symlinks is intended to check each component of a path, but failed
to restore the stripped trailing components after each iteration,
leaving a NUL byte in the middle of the path.
Tim Kientzle [Sun, 21 Feb 2016 20:34:57 +0000 (12:34 -0800)]
Fix for issue #623.
Apparently, people have come to expect that the following
is sufficient to get bit-for-bit identical output from tar:
* Same filenames
* Same contents
* Same uid, gid
* Same mtime (forced via "touch -t <timestamp>")
* Sorting entries
Bsdtar's "restricted pax" format violated this by including
ctime, atime, and birthtime (which are not updated by
'touch -t). So we should only emit those additional time
values in the full pax format.
People who are really serious about generating bit-for-bit
identical archives should really build their own command-line
interface: You can still use libarchive to build the output,
but your custom CLI could sort the entries and strip everything
except a bare minimum of basic metadata.
Dynamically determine supported compiler flags during configure
Some compilers (e.g., `xlc` on AIX) don't support GCC compiler flags.
This change dynamically tests for supported `COMMON_FLAGS`, which get
appended to `CFLAGS`.
Signed-off-by: Eric N. Vander Weele <ericvw@gmail.com>
Tim Kientzle [Sun, 14 Feb 2016 05:52:24 +0000 (21:52 -0800)]
Issue #659: Fix xar parsing of archives with appleextended ACLs
The parser treated the <appleextended> tag as both known and
unknown, leaving the parser in a state that prevented it
from reading any further attributes. Depending on the
order of attributes, this could result in a file with no
name, for instance.
Nate Rosenblum [Fri, 5 Feb 2016 17:15:14 +0000 (09:15 -0800)]
Make assertions explicit in sparse tests
Instead of trying to special-case sparse data vs dense data detection
in verify_sparse_file (by resetting the `data_blocks` if no holes are
found), make the expected number of data blocks an explicit parameter.
Simplifies a subsequently introduced test case; no functional changes.
Nate Rosenblum [Fri, 5 Feb 2016 14:28:58 +0000 (06:28 -0800)]
Fix sparse tests with holes at the end
Sparse file creation in test_sparse_basic failed to create holes at
the end of files. These tests don't presently verify the existence of
holes at the end (they are concerned only with the sparse data block
entries), but this change ensures that the input file matches the
expected hole/data layout.
Tim Kientzle [Mon, 1 Feb 2016 05:43:23 +0000 (21:43 -0800)]
Read very large RAR headers incrementally
Formerly, libarchive tried to read the entire header into
memory at once, which created problems for malformed RAR
files with 4GB header sizes. This was causing occasional
crashes of the test suite on memory-limited systems.