Andres Mejia [Sat, 6 Aug 2011 21:54:00 +0000 (17:54 -0400)]
Implement support for RAR files compressed using "best" and "good" method.
PPMd code used is public domain code from p7zip. It seems 7z and RAR "good" and
"best" compressed files had a lot in common. Very little changes were needed
from original code so that it would work with RAR files and work with
libarchive. Currently, this will not work correctly with largefiles compressed
using PPMd.
Back to simply invoke lha_crc16(). Crrently the total cost of the
calculation of CRC16 is almost the same as previous complex code,
so it is better that we make that code simple.
It would be better to return ARCHIVE_FAILED instead of ARCHIVE_FATAL
when there is something wrong in extracting RAR files, because
you may extract the next entry file in the RAR archive file.
Stop extracting a RAR file if making huffman table fails, and report it in order to avoid an infinity loop
at reading damaged RAR files, which is made by test_fuzz.
When Skipping data in a store mode, use rar->bytes_remaining instead of rar->packed_size.
a use of packed_size in that case will not work after archive_read_format_rar_read_data
has been called.
Check the return value of __archive_read_consume in decoding lzss to avoid infinity loop in test_fuzz
because rar->bitoffset can have untrusted value when reading damaged RAR files.
Colin Percival [Tue, 2 Aug 2011 12:20:40 +0000 (08:20 -0400)]
Fix printing of INT(MAX|64)_MIN. In append_int we had theoretically
undefined behaviour, but the code probably worked on all existing
compilers and platforms. In format_int we could get the wrong output,
but only on files created/modified 280 billion years before the Big
Bang.
Colin Percival [Tue, 2 Aug 2011 08:56:27 +0000 (04:56 -0400)]
Make sure that the argument to --strip-components is a number. Otherwise
if someone accidentally omits the argument, we'll silently eat the next
command line argument. (GNU tar checks this, otherwise I wouldn't bother.)
Reduce a use of memory for decoding huffman code in both lha and cab reader.
Its side effect significantly reduces L1 cache miss observed with cachegrind,
which is one of valgrind tools.
Colin Percival [Mon, 1 Aug 2011 16:13:32 +0000 (12:13 -0400)]
Fix mtree_atol16. There was a missing ++(*p), with the result that the
values "0x[1-9].*" would be mapped to INT64_MAX, "0x-[1-9].*" would be
mapped to -INT64_MAX (which is another bug; it should have been INT64_MIN),
and "0x0.*" and "0x-0.*" would result in an infinite loop.
As part of this fix, factor out the duplicated digit-or-alpha-or-ALPHA
parsing into a separate function; I'm sure this complexity was responsible
for the increment getting lost in the first place.
Colin Percival [Mon, 1 Aug 2011 07:41:48 +0000 (03:41 -0400)]
Fix overflow handling in mtree_atol10. Prior to this commit, the value
"-9223372036854775808" (aka. -2^63 aka. INT64_MIN) will be parsed and
returned as -9223372036854775807 (aka. -INT64_MAX).
Tim Kientzle [Tue, 19 Jul 2011 05:02:05 +0000 (01:02 -0400)]
When scanning the beginning of an ASCII text file to see if it
has a uuencode 'begin' sequence, only examine the first 128k.
Extend the test to verify that we don't recognize uuencoded
data with 512k of leading ASCII data.
In iso9660 writer and xar writer, always overwrite the existing file in the file tree
which file has the same name; it is better that front-end applications such as tar decide
how they handle that case.
Add support for a pax textended keyword, "SUN.holesdata", which describes where is
data or hole in the stored contents. The pax of Solaris records the keyword when
using -x pax option which specify a pax format, and the file is sparse.
Tim Kientzle [Tue, 12 Jul 2011 05:35:22 +0000 (01:35 -0400)]
Remove dead files.
These also apparently ruffled some feathers:
http://code.google.com/p/libarchive/issues/detail?id=162
http://bugs.debian.org/614390
http://public.kitware.com/Bug/view.php?id=11885
The same changes of In the Xar writer, ignore ineffective path names in the Xar archive
such as "." , "/" or "../" and fix that handling. This is the same as the recent changes of
the ISO9660 writer.
In the ISO writer, ignore ineffective path names in the ISO9660 file system
such as "." , "/" or "../" and fix that handling. This is to improve r3464 changes.
In the fuzz test, improve the calculation of damaging bytes so as to
make at least one byte damage of the sample file even if its size is less than 100 bytes.
Fix issue 106. The original problem happned on linux platform and I fixed it onece
in r3277 but it was not sufficient. This change consider it could happen on other
platforms that the entry object has one sparse block and it indicates the whole file
data, which sparse block is made by other program code(not only our code).
Tim Kientzle [Sun, 26 Jun 2011 04:09:09 +0000 (00:09 -0400)]
Extend the --newer-than test to verify the behavior when there's a new
file inside an old directory. Rework the descent logic in write.c
somewhat to fix the behavior here.
Fix counting files read, dot not count it up when returning ARCHIVE_EOF.
Add the check of the return value of archive_file_count() into several
format reader tests.