Re: svn commit: r309405 - head/contrib/libarchive/libarchive

2016-12-03 Thread Martin Matuska
Looks like older versions of "plexus-archiver" (plugin used by maven)
create malformed tar archives with spaced uid/gid fields (PLXCOMP-233).
I will fix that quickly or backout the header sanity check for now.

On 03.12.2016 22:48, Antoine Brodin wrote:
> On Fri, Dec 2, 2016 at 10:30 AM, Martin Matuska  wrote:
>> Author: mm
>> Date: Fri Dec  2 09:30:13 2016
>> New Revision: 309405
>> URL: https://svnweb.freebsd.org/changeset/base/309405
>>
>> Log:
>>   MFV r309403:
>>
>>   Sync libarchive with vendor.
>>
>>   Vendor bugfixes:
>>   Fix for heap-buffer-overflow in archive_le16dec()
>>   Fix for heap-buffer-overflow in uudecode_bidder_bid()
>>   Reworked fix for compatibility with archives created by Perl Archive::Tar
>>
>>   MFC after:1 week
> Hi,
>
> There are still ports failing to extract (logs are ipv6 only):
> http://beefy11.nyi.freebsd.org/data/head-i386-default/p427588_s309451/logs/errors/jakarta-commons-logging-1.2.log
> http://beefy11.nyi.freebsd.org/data/head-i386-default/p427588_s309451/logs/errors/activemq-5.14.1.log
> http://beefy11.nyi.freebsd.org/data/head-i386-default/p427588_s309451/logs/errors/hadoop2-2.7.2_1.log
>
> Please request an exp-run before updating libarchive.
>
> Cheers,
>
> Antoine


___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r309405 - head/contrib/libarchive/libarchive

2016-12-03 Thread Antoine Brodin
On Fri, Dec 2, 2016 at 10:30 AM, Martin Matuska  wrote:
> Author: mm
> Date: Fri Dec  2 09:30:13 2016
> New Revision: 309405
> URL: https://svnweb.freebsd.org/changeset/base/309405
>
> Log:
>   MFV r309403:
>
>   Sync libarchive with vendor.
>
>   Vendor bugfixes:
>   Fix for heap-buffer-overflow in archive_le16dec()
>   Fix for heap-buffer-overflow in uudecode_bidder_bid()
>   Reworked fix for compatibility with archives created by Perl Archive::Tar
>
>   MFC after:1 week

Hi,

There are still ports failing to extract (logs are ipv6 only):
http://beefy11.nyi.freebsd.org/data/head-i386-default/p427588_s309451/logs/errors/jakarta-commons-logging-1.2.log
http://beefy11.nyi.freebsd.org/data/head-i386-default/p427588_s309451/logs/errors/activemq-5.14.1.log
http://beefy11.nyi.freebsd.org/data/head-i386-default/p427588_s309451/logs/errors/hadoop2-2.7.2_1.log

Please request an exp-run before updating libarchive.

Cheers,

Antoine
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r309405 - head/contrib/libarchive/libarchive

2016-12-02 Thread Martin Matuska
Author: mm
Date: Fri Dec  2 09:30:13 2016
New Revision: 309405
URL: https://svnweb.freebsd.org/changeset/base/309405

Log:
  MFV r309403:
  
  Sync libarchive with vendor.
  
  Vendor bugfixes:
  Fix for heap-buffer-overflow in archive_le16dec()
  Fix for heap-buffer-overflow in uudecode_bidder_bid()
  Reworked fix for compatibility with archives created by Perl Archive::Tar
  
  MFC after:1 week

Modified:
  head/contrib/libarchive/libarchive/archive_read_support_filter_uu.c
  head/contrib/libarchive/libarchive/archive_read_support_format_cab.c
  head/contrib/libarchive/libarchive/archive_read_support_format_tar.c
Directory Properties:
  head/contrib/libarchive/   (props changed)

Modified: head/contrib/libarchive/libarchive/archive_read_support_filter_uu.c
==
--- head/contrib/libarchive/libarchive/archive_read_support_filter_uu.c Fri Dec 
 2 09:29:22 2016(r309404)
+++ head/contrib/libarchive/libarchive/archive_read_support_filter_uu.c Fri Dec 
 2 09:30:13 2016(r309405)
@@ -312,6 +312,7 @@ uudecode_bidder_bid(struct archive_read_
avail -= len;
 
if (l == 6) {
+   /* "begin " */
if (!uuchar[*b])
return (0);
/* Get a length of decoded bytes. */
@@ -352,8 +353,8 @@ uudecode_bidder_bid(struct archive_read_
b += nl;
if (avail && uuchar[*b])
return (firstline+30);
-   }
-   if (l == 13) {
+   } else if (l == 13) {
+   /* "begin-base64 " */
while (len-nl > 0) {
if (!base64[*b++])
return (0);

Modified: head/contrib/libarchive/libarchive/archive_read_support_format_cab.c
==
--- head/contrib/libarchive/libarchive/archive_read_support_format_cab.c
Fri Dec  2 09:29:22 2016(r309404)
+++ head/contrib/libarchive/libarchive/archive_read_support_format_cab.c
Fri Dec  2 09:30:13 2016(r309405)
@@ -645,12 +645,13 @@ cab_read_header(struct archive_read *a)
cab = (struct cab *)(a->format->data);
if (cab->found_header == 0 &&
p[0] == 'M' && p[1] == 'Z') {
-   /* This is an executable?  Must be self-extracting...   */
+   /* This is an executable?  Must be self-extracting... */
err = cab_skip_sfx(a);
if (err < ARCHIVE_WARN)
return (err);
 
-   if ((p = __archive_read_ahead(a, sizeof(*p), NULL)) == NULL)
+   /* Re-read header after processing the SFX. */
+   if ((p = __archive_read_ahead(a, 42, NULL)) == NULL)
return (truncated_error(a));
}
 

Modified: head/contrib/libarchive/libarchive/archive_read_support_format_tar.c
==
--- head/contrib/libarchive/libarchive/archive_read_support_format_tar.c
Fri Dec  2 09:29:22 2016(r309404)
+++ head/contrib/libarchive/libarchive/archive_read_support_format_tar.c
Fri Dec  2 09:30:13 2016(r309405)
@@ -297,58 +297,50 @@ archive_read_format_tar_cleanup(struct a
 /*
  * Validate number field
  *
- * Flags:
- * 1 - allow double \0 at field end
+ * This has to be pretty lenient in order to accomodate the enormous
+ * variety of tar writers in the world:
+ *  = POSIX ustar requires octal values with leading zeros and
+ *specific termination on fields
+ *  = Many writers use different termination (in particular, libarchive
+ *omits terminator bytes to squeeze one or two more digits)
+ *  = Many writers pad with space and omit leading zeros
+ *  = GNU tar and star write base-256 values if numbers are too
+ *big to be represented in octal
+ *
+ * This should tolerate all variants in use.  It will reject a field
+ * where the writer just left garbage after a trailing NUL.
  */
 static int
-validate_number_field(const char* p_field, size_t i_size, int flags)
+validate_number_field(const char* p_field, size_t i_size)
 {
unsigned char marker = (unsigned char)p_field[0];
-   /* octal? */
-   if ((marker >= '0' && marker <= '7') || marker == ' ') {
+   if (marker == 128 || marker == 255 || marker == 0) {
+   /* Base-256 marker, there's nothing we can check. */
+   return 1;
+   } else {
+   /* Must be octal */
size_t i = 0;
-   int octal_found = 0;
-   for (i = 0; i < i_size; ++i) {
-   switch (p_field[i])
-   {
-   case ' ':
-   /* skip any leading spaces and trailing space */
-   if (octal_found == 0 || i == i_size - 1) {
-   continue;