]> git.ipfire.org Git - thirdparty/libarchive.git/log
thirdparty/libarchive.git
10 years agoAdd vim swap files to .gitignore 565/head
Paul Harris [Tue, 23 Jun 2015 14:27:48 +0000 (22:27 +0800)] 
Add vim swap files to .gitignore

10 years agoMerge pull request #560 from TomerHeber/master
Tim Kientzle [Wed, 17 Jun 2015 04:40:16 +0000 (21:40 -0700)] 
Merge pull request #560 from TomerHeber/master

7z inflation fails. #556

10 years agoMerge pull request #1 from TomerHeber/fix-7zip-bug 560/head
TomerHeber [Tue, 16 Jun 2015 18:45:08 +0000 (21:45 +0300)] 
Merge pull request #1 from TomerHeber/fix-7zip-bug

Fix for issue - #556

10 years agoFix for issue - #556
TomerHeber [Tue, 16 Jun 2015 18:42:06 +0000 (21:42 +0300)] 
Fix for issue - #556

7z inflation fails

10 years agoIssue #520: Define BCRYPT_SUCCESS for VS2008
Tim Kientzle [Mon, 15 Jun 2015 18:16:16 +0000 (11:16 -0700)] 
Issue #520:  Define BCRYPT_SUCCESS for VS2008

10 years agoIssue #520: Visual Studio 2008 is not C99 compliant.
Tim Kientzle [Mon, 15 Jun 2015 17:54:56 +0000 (10:54 -0700)] 
Issue #520:  Visual Studio 2008 is not C99 compliant.

10 years agoMerge pull request #559 from Tarsnap/tarsnap
Tim Kientzle [Wed, 10 Jun 2015 14:51:30 +0000 (07:51 -0700)] 
Merge pull request #559 from Tarsnap/tarsnap

Minor libarchive fixes from tarsnap

10 years agoMerge branch 'master' of github.com:libarchive/libarchive
Tim Kientzle [Mon, 8 Jun 2015 13:02:46 +0000 (06:02 -0700)] 
Merge branch 'master' of github.com:libarchive/libarchive

10 years agoTest harness should use 'const' buffer here
Tim Kientzle [Mon, 8 Jun 2015 13:02:09 +0000 (06:02 -0700)] 
Test harness should use 'const' buffer here

10 years agoSpelling
Tim Kientzle [Mon, 8 Jun 2015 13:01:04 +0000 (06:01 -0700)] 
Spelling

10 years agoMerge pull request #555 from orex/master
Tim Kientzle [Sat, 6 Jun 2015 18:25:31 +0000 (11:25 -0700)] 
Merge pull request #555 from orex/master

archive_write_set_format_filter_by_ext: man pages updated.

10 years agoBSD format in manual. 555/head
Kirill Okhotnikov [Tue, 2 Jun 2015 07:47:56 +0000 (09:47 +0200)] 
BSD format in manual.

10 years agoFree any allocated memory upon allocation failure 559/head
Colin Percival [Sat, 30 May 2015 06:20:57 +0000 (23:20 -0700)] 
Free any allocated memory upon allocation failure

10 years agoComments: small spelling and grammar fixes
Colin Percival [Tue, 2 Jun 2015 05:05:59 +0000 (22:05 -0700)] 
Comments: small spelling and grammar fixes

10 years agoStrings: fix an incorrect name of a function
Colin Percival [Tue, 2 Jun 2015 04:57:04 +0000 (21:57 -0700)] 
Strings: fix an incorrect name of a function

10 years agoarchive_write_set_format_filter_by_ext: man pages updated.
Kirill Okhotnikov [Mon, 1 Jun 2015 08:31:12 +0000 (10:31 +0200)] 
archive_write_set_format_filter_by_ext: man pages updated.

10 years agoMerge pull request #106 from orex/corrected
Tim Kientzle [Sun, 31 May 2015 05:32:08 +0000 (22:32 -0700)] 
Merge pull request #106 from orex/corrected

Corrected

10 years agoMerge pull request #544 from pombreda/patch-1
Tim Kientzle [Tue, 19 May 2015 13:50:49 +0000 (06:50 -0700)] 
Merge pull request #544 from pombreda/patch-1

Fixed minor typo

10 years agoFixed minor typo 544/head
Philippe Ombredanne [Tue, 19 May 2015 08:21:35 +0000 (10:21 +0200)] 
Fixed minor typo

10 years agoIssue #543: Start building out some tests for MSDOS attributes
Tim Kientzle [Sun, 17 May 2015 21:24:34 +0000 (14:24 -0700)] 
Issue #543:  Start building out some tests for MSDOS attributes

10 years agoMerge pull request #536 from pombredanne/patch-1
Tim Kientzle [Sat, 16 May 2015 20:36:13 +0000 (13:36 -0700)] 
Merge pull request #536 from pombredanne/patch-1

Fixing path to UC Regents-copyrighted file.

10 years agoMerge pull request #537 from pombredanne/patch-2
Tim Kientzle [Sat, 16 May 2015 20:35:48 +0000 (13:35 -0700)] 
Merge pull request #537 from pombredanne/patch-2

Updating references to tar/matching.c and get_date.c

10 years agoIssue #523: Fail if entry is too small for encryption header.
Tim Kientzle [Sat, 16 May 2015 20:28:10 +0000 (13:28 -0700)] 
Issue #523: Fail if entry is too small for encryption header.

10 years agoIssue #539: Try a different way to compute max/min time_t values.
Tim Kientzle [Sat, 16 May 2015 19:16:28 +0000 (12:16 -0700)] 
Issue #539:  Try a different way to compute max/min time_t values.

10 years agoIssue #540: Fix test to avoid use-after-free error.
Tim Kientzle [Sat, 16 May 2015 18:21:16 +0000 (11:21 -0700)] 
Issue #540: Fix test to avoid use-after-free error.

10 years agoMerge branch 'master' of github.com:libarchive/libarchive
Tim Kientzle [Wed, 13 May 2015 15:12:58 +0000 (08:12 -0700)] 
Merge branch 'master' of github.com:libarchive/libarchive

10 years agoFix spelling of archive_read_data_into_fd
Tim Kientzle [Wed, 13 May 2015 15:12:40 +0000 (08:12 -0700)] 
Fix spelling of archive_read_data_into_fd

10 years agoUpdating references to tar/matching.c and get_date 537/head
Philippe Ombredanne [Mon, 11 May 2015 13:22:49 +0000 (15:22 +0200)] 
Updating references to tar/matching.c and get_date

tar/matching.c is no a longer a file in the codebase. It has been replaced by libarchive/archive_match.c which is different code.

tar/get_date.c is now libarchive archive_getdate.c

10 years agoFixing path to UC Regents-copyrighted file. 536/head
Philippe Ombredanne [Mon, 11 May 2015 13:11:11 +0000 (15:11 +0200)] 
Fixing path to UC Regents-copyrighted file.

The path pointed to a file whose name has changed.

10 years agoSmall cosmetic changes. 106/head
Kirill Okhotnikov [Mon, 11 May 2015 11:51:00 +0000 (13:51 +0200)] 
Small cosmetic changes.

10 years agoGithub Issue #529: mismatched const usage in archive_read_open_memory.c
Tim Kientzle [Sun, 10 May 2015 17:53:15 +0000 (10:53 -0700)] 
Github Issue #529:  mismatched const usage in archive_read_open_memory.c

10 years agoMerge branch 'master' of github.com:libarchive/libarchive
Tim Kientzle [Sun, 10 May 2015 17:50:22 +0000 (10:50 -0700)] 
Merge branch 'master' of github.com:libarchive/libarchive

10 years agoMerge pull request #102 from sergiud/master
Tim Kientzle [Sat, 9 May 2015 20:53:10 +0000 (13:53 -0700)] 
Merge pull request #102 from sergiud/master

Fix for VC compilation errors

10 years agoMerge pull request #534 from rossburton/master
Tim Kientzle [Sat, 9 May 2015 20:46:46 +0000 (13:46 -0700)] 
Merge pull request #534 from rossburton/master

Fix out of tree builds

10 years agoMerge pull request #531 from hinrichsenhans/master
Tim Kientzle [Sat, 9 May 2015 05:33:06 +0000 (22:33 -0700)] 
Merge pull request #531 from hinrichsenhans/master

Fixes for VS2012 Compile

10 years agoFix printing of special chars in strdump
Tim Kientzle [Fri, 8 May 2015 03:51:03 +0000 (20:51 -0700)] 
Fix printing of special chars in strdump

10 years agobuild: fix out of tree builds 534/head
Ross Burton [Tue, 5 May 2015 14:29:52 +0000 (15:29 +0100)] 
build: fix out of tree builds

When writing files with shell directly it's best to create the target
directory first, as it's possible that the build directory is almost empty.

In particular out of tree builds with automake's dependency tracking
disabled is an easy way of triggering this.

10 years agoFixes for VS2012 Compile 531/head
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)

10 years agoExtend Zip64 test to verify more of the format details
Tim Kientzle [Sun, 3 May 2015 04:40:26 +0000 (21:40 -0700)] 
Extend Zip64 test to verify more of the format details

10 years agoFixes for VS2012 Compile
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

10 years agoUse a macro wrapper on LL literals for compatibility with certain old Windows compilers.
Tim Kientzle [Sun, 26 Apr 2015 04:58:58 +0000 (21:58 -0700)] 
Use a macro wrapper on LL literals for compatibility with certain old Windows compilers.

10 years agoMerge branch 'master' of github.com:libarchive/libarchive
Tim Kientzle [Tue, 21 Apr 2015 04:07:14 +0000 (21:07 -0700)] 
Merge branch 'master' of github.com:libarchive/libarchive

10 years agoFix a missing asterisk in the sample code.
Tim Kientzle [Tue, 21 Apr 2015 04:06:53 +0000 (21:06 -0700)] 
Fix a missing asterisk in the sample code.

10 years agoMore wording changes
Tim Kientzle [Sun, 19 Apr 2015 01:14:17 +0000 (18:14 -0700)] 
More wording changes

10 years agoExpand CONTRIBUTING
Tim Kientzle [Sat, 18 Apr 2015 19:50:38 +0000 (12:50 -0700)] 
Expand CONTRIBUTING

10 years agoFix markdown typos
Tim Kientzle [Sat, 18 Apr 2015 19:28:15 +0000 (12:28 -0700)] 
Fix markdown typos

10 years agoMerge branch 'master' of github.com:libarchive/libarchive
Tim Kientzle [Sat, 18 Apr 2015 19:26:48 +0000 (12:26 -0700)] 
Merge branch 'master' of github.com:libarchive/libarchive

10 years agoAdd a CONTRIBUTING file. Github shows a link to this in the Issues tracker.
Tim Kientzle [Sat, 18 Apr 2015 19:26:14 +0000 (12:26 -0700)] 
Add a CONTRIBUTING file.  Github shows a link to this in the Issues tracker.

10 years agoTest support for UTF8 pathname extension in Zip archives
Tim Kientzle [Thu, 13 Nov 2014 04:21:36 +0000 (20:21 -0800)] 
Test support for UTF8 pathname extension in Zip archives

10 years agoMerge pull request #108 from maksqwe/zip_encryption
Tim Kientzle [Tue, 14 Apr 2015 04:35:00 +0000 (21:35 -0700)] 
Merge pull request #108 from maksqwe/zip_encryption

Fix check for ZIP_ENTRY_FLAG_ENCRYPTED

10 years agoUpdate iconv.m4
Tim Kientzle [Sun, 12 Apr 2015 18:49:09 +0000 (11:49 -0700)] 
Update iconv.m4

10 years agoReword this warning message.
Tim Kientzle [Sun, 12 Apr 2015 17:59:46 +0000 (10:59 -0700)] 
Reword this warning message.

10 years agoNudge the Zip64 cutoff a little higher.
Tim Kientzle [Sun, 12 Apr 2015 06:21:43 +0000 (23:21 -0700)] 
Nudge the Zip64 cutoff a little higher.

A simple test (feeding /dev/random through gzip) suggests
that deflate will only expand the data by 0.03% in the worst case.
So allow a 0.4% margin instead of the 6.25% I had here earlier.

10 years agoGithub Issue #522: Detect cycles in the ISO directory tree
Tim Kientzle [Sun, 12 Apr 2015 05:57:58 +0000 (22:57 -0700)] 
Github Issue #522: Detect cycles in the ISO directory tree

10 years agoIssue #522: Dir loop in malformed ISO causes segfault
Tim Kientzle [Sun, 12 Apr 2015 05:44:12 +0000 (22:44 -0700)] 
Issue #522: Dir loop in malformed ISO causes segfault

Github Issue #522 revealed that we could blow the stack
when recursing to assemble ISO paths.  I saw this happen
at 130,000 dir levels.  This patch addresses this by limiting
the directory recursion to 1,000 elements.

TODO:  It would be even better to track and detect the dir loop
directly.

10 years agoSelect Zip64 extensions a little more aggressively.
Tim Kientzle [Sat, 11 Apr 2015 20:24:32 +0000 (13:24 -0700)] 
Select Zip64 extensions a little more aggressively.

 * Compressed files close to 4GiB (in case compression makes file larger)

 * Include encryption overhead when checking whether file is too big.

 * Clarify comments

Suggested by a conversation on info-zip-dev mailing list.

10 years agoMerge pull request #112 from ngladitz/gnutar-large-id
Tim Kientzle [Sat, 11 Apr 2015 16:53:30 +0000 (09:53 -0700)] 
Merge pull request #112 from ngladitz/gnutar-large-id

Fall back to base-256 encoding for UID/GID like GNU tar does.

10 years agoREADME: Update issue tracker link to refer to GitHub issues
Brad King [Sat, 11 Apr 2015 16:32:05 +0000 (12:32 -0400)] 
README: Update issue tracker link to refer to GitHub issues

Also mention this in the NEWS file.

10 years agoINSTALL: Update Wiki link to refer to GitHub wiki
Brad King [Sat, 11 Apr 2015 16:31:09 +0000 (12:31 -0400)] 
INSTALL: Update Wiki link to refer to GitHub wiki

10 years agoFall back to base-256 encoding for UID/GID like GNU tar does. 112/head
Nils Gladitz [Wed, 8 Apr 2015 18:58:29 +0000 (20:58 +0200)] 
Fall back to base-256 encoding for UID/GID like GNU tar does.

10 years agofixed another compilation error 102/head
Sergiu Dotenco [Mon, 23 Mar 2015 13:07:38 +0000 (14:07 +0100)] 
fixed another compilation error

10 years agoMerge pull request #111 from andreasstieger/xattr
Tim Kientzle [Sun, 22 Mar 2015 20:27:03 +0000 (13:27 -0700)] 
Merge pull request #111 from andreasstieger/xattr

Fix a subtle wrong library check that caused libarchive to depend on lib...

10 years agoFix a subtle wrong library check that caused libarchive to depend on libattr when... 111/head
Andreas Stieger [Sun, 22 Mar 2015 19:44:26 +0000 (20:44 +0100)] 
Fix a subtle wrong library check that caused libarchive to depend on libattr when it should be using glibc.

10 years agoIf lzma_cputhreads() is unavailable, default the number of threads to 1.
Tim Kientzle [Sun, 8 Mar 2015 07:20:55 +0000 (23:20 -0800)] 
If lzma_cputhreads() is unavailable, default the number of threads to 1.

10 years agoMerge pull request #101 from chenxiaolong/install
Tim Kientzle [Thu, 5 Mar 2015 04:43:49 +0000 (20:43 -0800)] 
Merge pull request #101 from chenxiaolong/install

Allow library installation to be disabled in CMake

10 years agoMerge pull request #107 from rpaulo/master
Tim Kientzle [Thu, 5 Mar 2015 04:41:37 +0000 (20:41 -0800)] 
Merge pull request #107 from rpaulo/master

libarchive: use lzma_stream_encoder_mt() if it's available.

10 years agoMerge pull request #110 from ghedo/traversal
Tim Kientzle [Thu, 5 Mar 2015 04:36:23 +0000 (20:36 -0800)] 
Merge pull request #110 from ghedo/traversal

Fix directory traversal in bsdcpio

10 years agoAdd ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS option 110/head
Alessandro Ghedini [Sun, 1 Mar 2015 11:07:45 +0000 (12:07 +0100)] 
Add ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS option

This fixes a directory traversal in the cpio tool.

10 years agoIssue 270: Correct spelling of 'archive_write_header'
Tim Kientzle [Wed, 4 Mar 2015 05:09:44 +0000 (21:09 -0800)] 
Issue 270:  Correct spelling of 'archive_write_header'

10 years agoSplit out the compiler flags to make it easier to adjust locally.
Tim Kientzle [Wed, 4 Mar 2015 04:49:27 +0000 (20:49 -0800)] 
Split out the compiler flags to make it easier to adjust locally.

10 years agoRead_open_memory does not alter the data passed to it, so should accept const void...
Tim Kientzle [Wed, 4 Mar 2015 04:12:50 +0000 (20:12 -0800)] 
Read_open_memory does not alter the data passed to it, so should accept const void * arguments

10 years agoIssue 410: Segfault on invalid rar archive
Tim Kientzle [Wed, 4 Mar 2015 04:17:37 +0000 (20:17 -0800)] 
Issue 410: Segfault on invalid rar archive

Libarchive's API passes a void ** which is set by the format
to the address of the entry data that was just read.

In one particular case, the RAR decompression logic uses a
non-NULL value here to indicate that the internal 128k decompression
buffer has been filled.  But the RAR code took no steps to ensure
that the value was set NULL on entry.  As a result, a crafted RAR
file can trick libarchive into returning to the caller a 128k block
of data starting at whatever value was previously in the caller's
variable.

The fix is simply to set *buff = NULL on entry to the RAR
decompression logic.

10 years agoMerge branch 'master' of github.com:libarchive/libarchive
Sergiu Dotenco [Sun, 1 Mar 2015 11:28:04 +0000 (12:28 +0100)] 
Merge branch 'master' of github.com:libarchive/libarchive

Conflicts:
libarchive/archive_read_support_format_zip.c

10 years agoRemove mentions of a required signature. This was added
Tim Kientzle [Sun, 22 Feb 2015 19:46:17 +0000 (11:46 -0800)] 
Remove mentions of a required signature.  This was added
by libarchive but never caught on with other mtree implementations.

10 years agoIssue 408: Fix escaped newline parsing
Tim Kientzle [Sat, 21 Feb 2015 18:37:48 +0000 (10:37 -0800)] 
Issue 408: Fix escaped newline parsing

10 years agoIssue 407: Tar reader tries to examine last character of an empty filename
Tim Kientzle [Sat, 21 Feb 2015 17:36:23 +0000 (09:36 -0800)] 
Issue 407: Tar reader tries to examine last character of an empty filename

Of interest:  While working on this, I noted that we have
an existing test for tar files with empty filenames.
That test asserts that the correct behavior here is for the
format handler to return the entry with the empty filename
and a status of ARCHIVE_OK.  Clients need to be robust against
empty filenames.

10 years agoIssue 412: Use uint64_t throughout for file sizes
Tim Kientzle [Sat, 21 Feb 2015 05:37:37 +0000 (21:37 -0800)] 
Issue 412: Use uint64_t throughout for file sizes

10 years agoIssue 412: Be more careful about symlink length before trying to read it
Tim Kientzle [Sat, 21 Feb 2015 05:36:06 +0000 (21:36 -0800)] 
Issue 412: Be more careful about symlink length before trying to read it

10 years agoIssue 412: Visual Studio 2008 does not support C99
Tim Kientzle [Sat, 21 Feb 2015 05:32:31 +0000 (21:32 -0800)] 
Issue 412: Visual Studio 2008 does not support C99

10 years agoxz: add the xz:threads option. 107/head
Rui Paulo [Tue, 17 Feb 2015 19:19:55 +0000 (11:19 -0800)] 
xz: add the xz:threads option.

It's now possible to chose the number of threads used by the lzma
multi-threaded compressor using tar ... --xz --option xz:threads=N where
N is the number of threads.  When N is 0, it will create threads based
on the number of CPUs (following the xz(1) model).

10 years agoCMakeLists.txt: Make libxml2 and expat optional 101/head
Xiao-Long Chen [Sun, 15 Feb 2015 21:06:25 +0000 (16:06 -0500)] 
CMakeLists.txt: Make libxml2 and expat optional

10 years agoIssue 409: archive_read_extract object leaked
Tim Kientzle [Sat, 14 Feb 2015 04:20:15 +0000 (20:20 -0800)] 
Issue 409: archive_read_extract object leaked

Register the cleanup function for the object at the point
where the object is actually allocated to ensure that
it always gets cleaned up.

10 years agoFix check for ZIP_ENTRY_FLAG_ENCRYPTED 108/head
Maks Naumov [Tue, 10 Feb 2015 11:32:12 +0000 (13:32 +0200)] 
Fix check for ZIP_ENTRY_FLAG_ENCRYPTED

"zip->entry_flags | ZIP_ENTRY_FLAG_ENCRYPTED" is always true.

10 years agolibarchive: use lzma_stream_encoder_mt() if it's available.
Rui Paulo [Mon, 9 Feb 2015 18:15:38 +0000 (10:15 -0800)] 
libarchive: use lzma_stream_encoder_mt() if it's available.

This is the multi-threaded stream encoder version of lzma that brings
significant speed improvements.  libarchive is using all the available
threads when lzma_stream_encoder_mt() is present.

10 years agoNew functionality added for automatically choose write file format and filter by...
Kirill Okhotnikov [Mon, 9 Feb 2015 12:37:14 +0000 (13:37 +0100)] 
New functionality added for automatically choose write file format and filter by filename.

10 years agoWarning of unsed function "aes_ctr_encrypt_counter" were fixed.
Kirill Okhotnikov [Mon, 9 Feb 2015 10:17:44 +0000 (11:17 +0100)] 
Warning of unsed function "aes_ctr_encrypt_counter" were fixed.

10 years agoIssue 405: segfault on malformed 7z archive
Tim Kientzle [Sun, 8 Feb 2015 21:29:51 +0000 (13:29 -0800)] 
Issue 405: segfault on malformed 7z archive

Reject a couple of nonsensical cases.

10 years agoIssue 406: Segfault on malformed Zip archive
Tim Kientzle [Sun, 8 Feb 2015 03:03:43 +0000 (19:03 -0800)] 
Issue 406: Segfault on malformed Zip archive

Issue here was reading a size field as a signed number
and then using that as an offset.  Fixed by correctly
masking the size value to an unsigned result.

Includes test based on the archive provided in the issue report.

10 years agoA correct fix for Issue 404: Read past end of string parsing fflags
Tim Kientzle [Sat, 7 Feb 2015 21:44:34 +0000 (13:44 -0800)] 
A correct fix for Issue 404: Read past end of string parsing fflags

The previous fix actually broke the fflag parsing.  We
cannot use strcmp() here because we're comparing a null-terminated
string to a part of another string.

This fix explicitly tracks the various string lengths and
checks that they match before calling memcmp() or wmemcmp().
That avoids any buffer overrun without breaking the parser.

10 years agoIssue 402: Failed to recognize empty dir name in lha/lzh file
Tim Kientzle [Sat, 7 Feb 2015 21:32:58 +0000 (13:32 -0800)] 
Issue 402: Failed to recognize empty dir name in lha/lzh file

When parsing a directory name, we checked for the name
length being zero, but not for the first byte being a
null byte.  Add a similar check for the file case.

10 years agoCorrect the spelling of 'wcscmp'.
Tim Kientzle [Sat, 7 Feb 2015 21:16:12 +0000 (13:16 -0800)] 
Correct the spelling of 'wcscmp'.

10 years agoIssue 404: Read past end of string parsing fflags
Tim Kientzle [Sat, 7 Feb 2015 20:59:39 +0000 (12:59 -0800)] 
Issue 404: Read past end of string parsing fflags

10 years agoIssue 403: Buffer underflow parsing 'ar' header
Tim Kientzle [Sat, 7 Feb 2015 20:35:33 +0000 (12:35 -0800)] 
Issue 403: Buffer underflow parsing 'ar' header

While pruning trailing text from ar filenames, we did not
check for an empty filename.  This results in reading the byte
before the filename on the stack.

While here, change a number of ar format issues from WARN to FATAL.
It's better to abort on a damaged file than risk reading garbage.
No doubt, this will require additional tuning in the future.

10 years agoIssue 400: Crash reading malformed compress (.Z) input
Tim Kientzle [Sat, 7 Feb 2015 07:39:33 +0000 (23:39 -0800)] 
Issue 400: Crash reading malformed compress (.Z) input

The KwKwK case can never validly appear as the first token
after a reset.

Thanks to the afl-gcc folks for finding this.

10 years agoIssue 398: Overlapping memcpy
Tim Kientzle [Sat, 7 Feb 2015 07:00:30 +0000 (23:00 -0800)] 
Issue 398: Overlapping memcpy

Some of the pathname edits parse a part of the pathname
in the entry, then try to set the pathname from that part.
This leads the text routines to memcpy() from within the
string buffer.

Avoid this by simply using memmove() for low-level string append
operations.

10 years agoIssues 396, 397: Ignore entries with empty filenames.
Tim Kientzle [Sat, 7 Feb 2015 06:45:58 +0000 (22:45 -0800)] 
Issues 396, 397: Ignore entries with empty filenames.

Bugs in the rar and cab readers lead to returning entries
with empty filenames.  Make bsdtar resistant to this.

Of course, we should also fix the rar and cab
readers to handle these cases correctly and either
return correctly-populated entries or fail cleanly.

10 years agoSet a proper error message if we hit end-of-file when
Tim Kientzle [Sat, 7 Feb 2015 06:07:16 +0000 (22:07 -0800)] 
Set a proper error message if we hit end-of-file when
trying to read a cpio header.

Suggested by Issue #395, although the actual problem there
seems to have been the same as Issue #394.

10 years agoMerge pull request #104 from snarkmaster/improve_skips
Tim Kientzle [Sat, 7 Feb 2015 05:37:43 +0000 (21:37 -0800)] 
Merge pull request #104 from snarkmaster/improve_skips

Do not request 0-length skips; sanity-check return.

10 years agoDo not request 0-length skips; sanity-check return. 104/head
Alexey Spiridonov [Mon, 2 Feb 2015 03:26:26 +0000 (19:26 -0800)] 
Do not request 0-length skips; sanity-check return.

I noticed that my skip callback was always being invoked with a request of
0.  This is a bit wasteful since skip callbacks commonly involve a syscall
like lseek().

Also, it seems good to error out when the skip callback is buggy, and claims
to skip more than requested.

Test Plan:

```
autoreconf -ivf && ./configure && make && make check
```

The same tests fail as before, with the same error messages. If interested,
both failure logs are here:

https://github.com/snarkmaster/libarchive/commit/00c9751cde6cc888fb844b7a1fcc0f82dbaaedb1

These are on Ubuntu 14.04.

10 years agoAdd a check to archive_read_filter_consume to reject any
Tim Kientzle [Sat, 31 Jan 2015 07:57:03 +0000 (23:57 -0800)] 
Add a check to archive_read_filter_consume to reject any
attempts to move the file pointer by a negative amount.

Note:  Either this or commit 3865cf2 provides a fix for
Issue 394.