Brad King [Wed, 21 Oct 2015 16:02:21 +0000 (12:02 -0400)]
Avoid left-shift overflow of signed integer
In libarchive/archive_write_set_format_zip.c there are two calls to
archive_le32enc whose second argument is of the form
archive_entry_mode(zip->entry) << 16
However, the return type from archive_entry_mode may be a signed integer
so the shift may overflow. Since the second argument of archive_le32enc
expects uint32_t anyway, simply cast to that prior to shifting.
Tim Kientzle [Sun, 6 Sep 2015 05:43:09 +0000 (22:43 -0700)]
Rework the la_ssize_t and la_int64_t definitions to avoid
redefining la_int64_t if both archive.h and archive_entry.h are
included. (This avoids a warning from clang that redefining
a typedef is a C11 feature.)
Graham Percival [Sun, 30 Aug 2015 17:53:12 +0000 (10:53 -0700)]
Warn if target of hard-link is not present
To reproduce,
touch a
ln a b
./bsdtar -c -f warn-hard-links.tar a b
rm a b
./bsdtar -x -f warn-hard-links.tar b
should produce a warning message about failing to create 'b' because the
hard-link target 'a' does not exist. Previously, it did not give any hints
about why 'b' could not be created.
Tim Kientzle [Thu, 27 Aug 2015 15:42:02 +0000 (08:42 -0700)]
Issue 593: Add .travis.yml for Travis-CI
This will help people who want to use Travis-CI to follow
libarchive development. Including Travis-CI status in the
README.md is a separate issue that requires one of the
libarchive maintainers to commit to managing it.
Tim Kientzle [Sun, 9 Aug 2015 04:47:43 +0000 (21:47 -0700)]
Issue 547: problems with compress bidder
The code previously was not very careful about verifying the
compression parameters. This led to cases where it failed to
reject invalid compressed data at the beginning. The invalid
left shift was one symptom of this.
The code is now more careful: It verifies that the compression
parameter byte exists and verifies that the maximum code size
is <= 16 bits.
This also includes some new tests to verify that truncated or
otherwise invalid compressed data is rejected.
Tim Kientzle [Sun, 9 Aug 2015 03:52:19 +0000 (20:52 -0700)]
Issue 551: Fix the best-effort UTF8 conversion
If a valid character set conversion is impossible, the code falls back
to a best-effort conversion that preserves ASCII bytes and converts
the rest to Unicode Replacement Characters (if the output is UTF8)
or '?' (otherwise). This code did not correctly track the remaining
bytes in the output buffer; I've replaced this with slower and simpler
code that utilizes the safe string append functions.
configure.ac: Use pkg-config to find libxml2. Fixes cross compilation
This was originally submitted to Google Code, and was carried over
during GitHub migration; however, it was in patch form, so I've made
a pull request for it for quicker merging.
Original source: https://github.com/libarchive/libarchive/issues/407
Original author: ambrop7
When you need to write a callback for archive_read_open2, you must provide a
function which has the same signature as the typedef. The documentation says
that the read callback returns a ssize_t, but on windows there is no such
ssize_t. libarchive falls back on another type and use the private macro
__LA_SSIZE_T, thus it is not possible to write portable code that use
read_open2.
This patch replaces that macro with a simple typedef la_ssize_t (and does the
same for la_int64_t).
Brooks Davis [Tue, 10 Feb 2015 17:43:10 +0000 (17:43 +0000)]
Add a new tar option --clear-nochange-fflags that causes file system
flags which might prevent the removal or modifiction of files to
be cleared before attempting to remove them.
Brooks Davis [Tue, 10 Feb 2015 17:39:51 +0000 (17:39 +0000)]
Add a new archive_write_disk option:ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS
that clears platform-specific file flags that might prevent the removal
of a file system object before attempting to remove it.
Hans Hinrichsen [Tue, 5 May 2015 03:30:01 +0000 (22:30 -0500)]
Fixes for VS2012 Compile
Updated includes in bsdtar_windows.h to bring in _setmode and _O_BINARY via io.h and fcntl.h
Explicitly cast a few void * to their structs to suppress Intellisense warnings
Moved variable in read_archive - VS2012 needs variables declared at the top of the block (does not support C99)
Hans Hinrichsen [Thu, 30 Apr 2015 03:45:31 +0000 (22:45 -0500)]
Fixes for VS2012 Compile
Fixes for VS2012 Compile
Added headers needed when compiling in Win32 without Cygwin
Some pointers needed to be explicitly cast
VS had a lot of trouble with storing the result of
archive_entry_pathname in a local variable
The only way I could get it to compile was to call the function twice