svn commit: r282927 - vendor/libarchive/dist/libarchive
Xin LI
delphij at FreeBSD.org
Thu May 14 21:33:34 UTC 2015
Author: delphij
Date: Thu May 14 21:33:33 2015
New Revision: 282927
URL: https://svnweb.freebsd.org/changeset/base/282927
Log:
Apply upstream changeset 3865cf2:
Issue 394: Segfault when reading malformed old-style cpio archives
Root cause here was an implicit cast that resulted in
reading very large file sizes as negative numbers.
Modified:
vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c
Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c
==============================================================================
--- vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Thu May 14 21:30:36 2015 (r282926)
+++ vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Thu May 14 21:33:33 2015 (r282927)
@@ -198,7 +198,7 @@ static int archive_read_format_cpio_read
static int archive_read_format_cpio_read_header(struct archive_read *,
struct archive_entry *);
static int archive_read_format_cpio_skip(struct archive_read *);
-static int be4(const unsigned char *);
+static int64_t be4(const unsigned char *);
static int find_odc_header(struct archive_read *);
static int find_newc_header(struct archive_read *);
static int header_bin_be(struct archive_read *, struct cpio *,
@@ -213,7 +213,7 @@ static int header_afiol(struct archive_r
struct archive_entry *, size_t *, size_t *);
static int is_octal(const char *, size_t);
static int is_hex(const char *, size_t);
-static int le4(const unsigned char *);
+static int64_t le4(const unsigned char *);
static int record_hardlink(struct archive_read *a,
struct cpio *cpio, struct archive_entry *entry);
@@ -944,17 +944,17 @@ archive_read_format_cpio_cleanup(struct
return (ARCHIVE_OK);
}
-static int
+static int64_t
le4(const unsigned char *p)
{
- return ((p[0]<<16) + (p[1]<<24) + (p[2]<<0) + (p[3]<<8));
+ return ((p[0] << 16) + (((int64_t)p[1]) << 24) + (p[2] << 0) + (p[3] << 8));
}
-static int
+static int64_t
be4(const unsigned char *p)
{
- return ((p[0]<<24) + (p[1]<<16) + (p[2]<<8) + (p[3]));
+ return ((((int64_t)p[0]) << 24) + (p[1] << 16) + (p[2] << 8) + (p[3]));
}
/*
More information about the svn-src-vendor
mailing list