From 1eee46f00d353b12c16eb2a40ada65865e63d390 Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Thu, 17 Jul 2014 14:07:33 -0400 Subject: [PATCH 1/3] fix license handling --- libarchive.spec | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/libarchive.spec b/libarchive.spec index 379da38..ea85268 100644 --- a/libarchive.spec +++ b/libarchive.spec @@ -1,6 +1,6 @@ Name: libarchive Version: 3.1.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: A library for handling streaming archive formats Group: System Environment/Libraries @@ -140,7 +140,9 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) -%doc COPYING README NEWS +%{!?_licensedir:%global license %%doc} +%license COPYING +%doc README NEWS %{_libdir}/libarchive.so.13* %{_mandir}/*/cpio.* %{_mandir}/*/mtree.* @@ -157,18 +159,25 @@ rm -rf $RPM_BUILD_ROOT %files -n bsdtar %defattr(-,root,root,-) -%doc COPYING README NEWS +%{!?_licensedir:%global license %%doc} +%license COPYING +%doc README NEWS %{_bindir}/bsdtar %{_mandir}/*/bsdtar* %files -n bsdcpio %defattr(-,root,root,-) -%doc COPYING README NEWS +%{!?_licensedir:%global license %%doc} +%license COPYING +%doc README NEWS %{_bindir}/bsdcpio %{_mandir}/*/bsdcpio* %changelog +* Thu Jul 17 2014 Tom Callaway - 3.1.2-9 +- fix license handling + * Sat Jun 07 2014 Fedora Release Engineering - 3.1.2-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild From 9aee0c3c4210c4231225c799899cff39d438d4b0 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sun, 17 Aug 2014 02:19:29 +0000 Subject: [PATCH 2/3] - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild --- libarchive.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libarchive.spec b/libarchive.spec index ea85268..2db3a85 100644 --- a/libarchive.spec +++ b/libarchive.spec @@ -1,6 +1,6 @@ Name: libarchive Version: 3.1.2 -Release: 9%{?dist} +Release: 10%{?dist} Summary: A library for handling streaming archive formats Group: System Environment/Libraries @@ -175,6 +175,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sun Aug 17 2014 Fedora Release Engineering - 3.1.2-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + * Thu Jul 17 2014 Tom Callaway - 3.1.2-9 - fix license handling From 8479302c4b1e14087e0706ed03e25a5da43fd47e Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Wed, 29 Apr 2015 10:28:31 +0200 Subject: [PATCH 3/3] libarchive: fix segfault for broken cpio archives Resolves: rhbz#1216891, rhbz#1216892 Version: 3.1.2-11 --- libarchive-3.1.2-security-rhbz-1216891.patch | 119 +++++++++++++++++++ libarchive.spec | 9 +- 2 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 libarchive-3.1.2-security-rhbz-1216891.patch diff --git a/libarchive-3.1.2-security-rhbz-1216891.patch b/libarchive-3.1.2-security-rhbz-1216891.patch new file mode 100644 index 0000000..d2d6f9b --- /dev/null +++ b/libarchive-3.1.2-security-rhbz-1216891.patch @@ -0,0 +1,119 @@ +From df29aeb7db98d227aea966b18261e5c1d97d223a Mon Sep 17 00:00:00 2001 +From: Pavel Raiskup +Date: Wed, 29 Apr 2015 10:23:01 +0200 +Subject: [PATCH] Upstream 3865cf2bc e6c9668f 24f5de65 --- From: Tim Kientzle + Date: Fri, 30 Jan 2015 23:54:19 -0800 Subject: [PATCH] + 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. + +--- +From: Tim Kientzle +Date: Fri, 30 Jan 2015 23:57:03 -0800 +Subject: [PATCH] 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. + +--- +From: Tim Kientzle +Date: Fri, 6 Feb 2015 22:07:16 -0800 +Subject: [PATCH] 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. +--- + libarchive/archive_read.c | 2 ++ + libarchive/archive_read_support_format_cpio.c | 22 ++++++++++++++-------- + 2 files changed, 16 insertions(+), 8 deletions(-) + +diff --git a/libarchive/archive_read.c b/libarchive/archive_read.c +index 048c316..7f3edc1 100644 +--- a/libarchive/archive_read.c ++++ b/libarchive/archive_read.c +@@ -1394,6 +1394,8 @@ __archive_read_filter_consume(struct archive_read_filter * filter, + { + int64_t skipped; + ++ if (request < 0) ++ return ARCHIVE_FATAL; + if (request == 0) + return 0; + +diff --git a/libarchive/archive_read_support_format_cpio.c b/libarchive/archive_read_support_format_cpio.c +index 819f4a4..1dabc47 100644 +--- a/libarchive/archive_read_support_format_cpio.c ++++ b/libarchive/archive_read_support_format_cpio.c +@@ -198,7 +198,7 @@ static int archive_read_format_cpio_read_data(struct archive_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_read *, struct cpio *, + 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); + +@@ -864,8 +864,11 @@ header_bin_le(struct archive_read *a, struct cpio *cpio, + + /* Read fixed-size portion of header. */ + h = __archive_read_ahead(a, bin_header_size, NULL); +- if (h == NULL) ++ if (h == NULL) { ++ archive_set_error(&a->archive, 0, ++ "End of file trying to read next cpio header"); + return (ARCHIVE_FATAL); ++ } + + /* Parse out binary fields. */ + header = (const unsigned char *)h; +@@ -900,8 +903,11 @@ header_bin_be(struct archive_read *a, struct cpio *cpio, + + /* Read fixed-size portion of header. */ + h = __archive_read_ahead(a, bin_header_size, NULL); +- if (h == NULL) ++ if (h == NULL) { ++ archive_set_error(&a->archive, 0, ++ "End of file trying to read next cpio header"); + return (ARCHIVE_FATAL); ++ } + + /* Parse out binary fields. */ + header = (const unsigned char *)h; +@@ -944,17 +950,17 @@ archive_read_format_cpio_cleanup(struct archive_read *a) + 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])); + } + + /* +-- +2.1.0 + diff --git a/libarchive.spec b/libarchive.spec index 2db3a85..a3d72e4 100644 --- a/libarchive.spec +++ b/libarchive.spec @@ -1,6 +1,6 @@ Name: libarchive Version: 3.1.2 -Release: 10%{?dist} +Release: 11%{?dist} Summary: A library for handling streaming archive formats Group: System Environment/Libraries @@ -32,6 +32,9 @@ Patch1: libarchive-3.1.2-testsuite.patch Patch2: libarchive-3.1.2-acl.patch +# ~> upstream patches: 3865cf2b e6c9668f 24f5de65 +Patch3: libarchive-3.1.2-security-rhbz-1216891.patch + %description Libarchive is a programming library that can create and read several different streaming archive formats, including most popular tar variants, several cpio @@ -77,6 +80,7 @@ libarchive packages. # fix not working saving/restoring acl # ~> downstream %patch2 -p1 -b .fix-acl +%patch3 -p1 -b .segfault-cpio %build @@ -175,6 +179,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Wed Apr 29 2015 Pavel Raiskup - 3.1.2-11 +- fix libarchive segfault for intentionally broken cpio archives (rhbz#1216892) + * Sun Aug 17 2014 Fedora Release Engineering - 3.1.2-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild