summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Modules/FindPkgConfig.cmake8
-rw-r--r--Modules/FindQt4.cmake2
-rw-r--r--Modules/Platform/Windows-MSVC.cmake2
-rw-r--r--README.rst2
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx18
-rw-r--r--Source/cmVS14CLFlagTable.h1
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake13
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake3
-rw-r--r--Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake7
-rw-r--r--Utilities/cmlibarchive/build/version2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive.h4
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_entry.h2
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_entry_xattr.c9
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_ppmd7.c5
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c3
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c5
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c4
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c6
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c18
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c6
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c13
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c14
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_filter.31
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_format_gnutar.c22
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c18
-rw-r--r--Utilities/cmlibarchive/libarchive/archive_write_set_options.32
-rw-r--r--Utilities/cmlibarchive/libarchive/libarchive-formats.51
-rw-r--r--Utilities/cmlibarchive/libarchive/libarchive_changes.32
28 files changed, 122 insertions, 71 deletions
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 644687c01f..b79e9df11e 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -591,12 +591,14 @@ endmacro()
XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
#]========================================]
macro(pkg_check_modules _prefix _module0)
+ _pkgconfig_parse_options(_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN})
# check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
- _pkgconfig_parse_options (_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN})
_pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} "${_prefix}" ${_pkg_modules})
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
+ elseif (${_prefix}_FOUND AND ${_imp_target})
+ _pkg_create_imp_target("${_prefix}" _no_cmake_path _no_cmake_environment_path)
endif()
endmacro()
@@ -619,10 +621,10 @@ endmacro()
pkg_search_module (BAR libxml-2.0 libxml2 libxml>=2)
#]========================================]
macro(pkg_search_module _prefix _module0)
+ _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN})
# check cached value
if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
set(_pkg_modules_found 0)
- _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path _imp_target "${_module0}" ${ARGN})
if (NOT ${_pkg_is_silent})
message(STATUS "Checking for one of the modules '${_pkg_modules_alt}'")
@@ -646,6 +648,8 @@ macro(pkg_search_module _prefix _module0)
endif()
_pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
+ elseif (${_prefix}_FOUND AND ${_imp_target})
+ _pkg_create_imp_target("${_prefix}" _no_cmake_path _no_cmake_environment_path)
endif()
endmacro()
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 11091b537b..d167a1392e 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -240,6 +240,8 @@
# The QAxServer target (Windows only)
# ``Qt4::QtDBus``
# The QtDBus target
+# ``Qt4::QtDeclarative``
+# The QtDeclarative target
# ``Qt4::QtDesigner``
# The QtDesigner target
# ``Qt4::QtDesignerComponents``
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 1920a7c61d..6c254ede44 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -305,7 +305,7 @@ macro(__windows_compiler_msvc lang)
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-D_DEBUG /MDd -gline-tables-only -fno-inline -O0 ${_RTC1}")
set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD -O2 -DNDEBUG")
set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD -gline-tables-only -O2 -fno-inline -DNDEBUG")
- set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD -Os -DNDEBUG")
+ set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD -DNDEBUG") # TODO: Add '-Os' once VS generator maps it properly for Clang
else()
set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}")
set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}")
diff --git a/README.rst b/README.rst
index 9599a04b03..4188ea04c1 100644
--- a/README.rst
+++ b/README.rst
@@ -89,7 +89,7 @@ If you have found a bug:
3. Finally, if the issue is not resolved by the above steps, open
an entry in the `CMake Issue Tracker`_.
-.. _`CMake Issue Tracker`: https://cmake.org/Bug
+.. _`CMake Issue Tracker`: https://gitlab.kitware.com/cmake/cmake/issues
Contributing
============
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 2070b1f7ff..589bf53b06 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -578,19 +578,20 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
}
// the include directories for this target
- std::set<std::string> uniqIncludeDirs;
+ std::vector<std::string> allIncludeDirs;
std::vector<std::string> includes;
lg->GetIncludeDirectories(includes, target, "C", buildType);
- uniqIncludeDirs.insert(includes.begin(), includes.end());
+ allIncludeDirs.insert(allIncludeDirs.end(), includes.begin(),
+ includes.end());
std::string systemIncludeDirs = makefile->GetSafeDefinition(
"CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
if (!systemIncludeDirs.empty()) {
std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
- uniqIncludeDirs.insert(dirs.begin(), dirs.end());
+ allIncludeDirs.insert(allIncludeDirs.end(), dirs.begin(), dirs.end());
}
systemIncludeDirs = makefile->GetSafeDefinition(
@@ -598,13 +599,16 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
if (!systemIncludeDirs.empty()) {
std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
- uniqIncludeDirs.insert(dirs.begin(), dirs.end());
+ allIncludeDirs.insert(allIncludeDirs.end(), dirs.begin(), dirs.end());
}
- for (std::set<std::string>::const_iterator dirIt = uniqIncludeDirs.begin();
- dirIt != uniqIncludeDirs.end(); ++dirIt) {
+ std::vector<std::string>::const_iterator end =
+ cmRemoveDuplicates(allIncludeDirs);
+
+ for (std::vector<std::string>::const_iterator i = allIncludeDirs.begin();
+ i != end; ++i) {
xml.StartElement("Add");
- xml.Attribute("directory", *dirIt);
+ xml.Attribute("directory", *i);
xml.EndElement();
}
diff --git a/Source/cmVS14CLFlagTable.h b/Source/cmVS14CLFlagTable.h
index 4243f30d1b..5812e79e85 100644
--- a/Source/cmVS14CLFlagTable.h
+++ b/Source/cmVS14CLFlagTable.h
@@ -16,7 +16,6 @@ static cmVS7FlagTable cmVS14CLFlagTable[] = {
{ "Optimization", "", "Custom", "Custom", 0 },
{ "Optimization", "Od", "Disabled", "Disabled", 0 },
- { "Optimization", "Os", "Minimize Size", "MinSize", 0 },
{ "Optimization", "O1", "Minimize Size", "MinSpace", 0 },
{ "Optimization", "O2", "Maximize Speed", "MaxSpeed", 0 },
{ "Optimization", "Ox", "Full Optimization", "Full", 0 },
diff --git a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake
index 5f929ff7c1..85e137fec4 100644
--- a/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/DEB/DEB_EXTRA-VerifyResult.cmake
@@ -1,17 +1,18 @@
set(foo_preinst "^echo default_preinst$")
-set(foo_preinst_permissions_regex "-rwxr-xr-x .*")
+# NOTE: optional dot at the end of permissions regex is for SELinux enabled systems
+set(foo_preinst_permissions_regex "-rwxr-xr-x\.? .*")
set(foo_prerm "^echo default_prerm$")
-set(foo_prerm_permissions_regex "-rwxr-xr-x .*")
+set(foo_prerm_permissions_regex "-rwxr-xr-x\.? .*")
verifyDebControl("${FOUND_FILE_1}" "foo" "preinst;prerm")
set(bar_preinst "^echo bar_preinst$")
-set(bar_prerm_permissions_regex "-rwx------ .*")
+set(bar_preinst_permissions_regex "-rwx------\.? .*")
set(bar_prerm "^echo bar_prerm$")
-set(bar_prerm_permissions_regex "-rwx------ .*")
+set(bar_prerm_permissions_regex "-rwx------\.? .*")
verifyDebControl("${FOUND_FILE_2}" "bar" "preinst;prerm")
set(bas_preinst "^echo default_preinst$")
-set(bas_prerm_permissions_regex "-rwxr-xr-x .*")
+set(bas_preinst_permissions_regex "-rwxr-xr-x\.? .*")
set(bas_prerm "^echo default_prerm$")
-set(bas_prerm_permissions_regex "-rwxr-xr-x .*")
+set(bas_prerm_permissions_regex "-rwxr-xr-x\.? .*")
verifyDebControl("${FOUND_FILE_3}" "bas" "preinst;prerm")
diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake
index 8ccb628258..b1952efd11 100644
--- a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS-VerifyResult.cmake
@@ -1,3 +1,4 @@
set(shlibs_shlibs "^libtest_lib 0\\.8 generate_shlibs \\(\\= 0\\.1\\.1\\)\n$")
-set(shlibs_shlibs_permissions_regex "-rw-r--r-- .*")
+# optional dot at the end of permissions regex is for SELinux enabled systems
+set(shlibs_shlibs_permissions_regex "-rw-r--r--\.? .*")
verifyDebControl("${FOUND_FILE_1}" "shlibs" "shlibs")
diff --git a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake
index d04c641361..422cfbe42c 100644
--- a/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake
+++ b/Tests/RunCMake/CPack/DEB/DEB_GENERATE_SHLIBS_LDCONFIG-VerifyResult.cmake
@@ -1,7 +1,8 @@
set(shlibs_shlibs "^libtest_lib 0\\.8 generate_shlibs_ldconfig \\(>\\= 0\\.1\\.1\\)\n$")
-set(shlibs_shlibs_permissions_regex "-rw-r--r-- .*")
+# NOTE: optional dot at the end of permissions regex is for SELinux enabled systems
+set(shlibs_shlibs_permissions_regex "-rw-r--r--\.? .*")
set(shlibs_postinst ".*ldconfig.*")
-set(shlibs_postinst_permissions_regex "-rwxr-xr-x .*")
+set(shlibs_postinst_permissions_regex "-rwxr-xr-x\.? .*")
set(shlibs_postrm ".*ldconfig.*")
-set(shlibs_postrm_permissions_regex "-rwxr-xr-x .*")
+set(shlibs_postrm_permissions_regex "-rwxr-xr-x\.? .*")
verifyDebControl("${FOUND_FILE_1}" "shlibs" "shlibs;postinst;postrm")
diff --git a/Utilities/cmlibarchive/build/version b/Utilities/cmlibarchive/build/version
index 595378f105..f293156370 100644
--- a/Utilities/cmlibarchive/build/version
+++ b/Utilities/cmlibarchive/build/version
@@ -1 +1 @@
-3002000
+3002001
diff --git a/Utilities/cmlibarchive/libarchive/archive.h b/Utilities/cmlibarchive/libarchive/archive.h
index a8aa704e7f..3b5104b372 100644
--- a/Utilities/cmlibarchive/libarchive/archive.h
+++ b/Utilities/cmlibarchive/libarchive/archive.h
@@ -36,7 +36,7 @@
* assert that ARCHIVE_VERSION_NUMBER >= 2012108.
*/
/* Note: Compiler will complain if this does not match archive_entry.h! */
-#define ARCHIVE_VERSION_NUMBER 3002000
+#define ARCHIVE_VERSION_NUMBER 3002001
#include <sys/stat.h>
#include <stddef.h> /* for wchar_t */
@@ -152,7 +152,7 @@ __LA_DECL int archive_version_number(void);
/*
* Textual name/version of the library, useful for version displays.
*/
-#define ARCHIVE_VERSION_ONLY_STRING "3.2.0"
+#define ARCHIVE_VERSION_ONLY_STRING "3.2.1"
#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
__LA_DECL const char * archive_version_string(void);
diff --git a/Utilities/cmlibarchive/libarchive/archive_entry.h b/Utilities/cmlibarchive/libarchive/archive_entry.h
index 2bc2928033..81cd425e49 100644
--- a/Utilities/cmlibarchive/libarchive/archive_entry.h
+++ b/Utilities/cmlibarchive/libarchive/archive_entry.h
@@ -29,7 +29,7 @@
#define ARCHIVE_ENTRY_H_INCLUDED
/* Note: Compiler will complain if this does not match archive.h! */
-#define ARCHIVE_VERSION_NUMBER 3002000
+#define ARCHIVE_VERSION_NUMBER 3002001
/*
* Note: archive_entry.h is for use outside of libarchive; the
diff --git a/Utilities/cmlibarchive/libarchive/archive_entry_xattr.c b/Utilities/cmlibarchive/libarchive/archive_entry_xattr.c
index 05eb90f1af..5fe726b99d 100644
--- a/Utilities/cmlibarchive/libarchive/archive_entry_xattr.c
+++ b/Utilities/cmlibarchive/libarchive/archive_entry_xattr.c
@@ -91,16 +91,11 @@ archive_entry_xattr_add_entry(struct archive_entry *entry,
{
struct ae_xattr *xp;
- for (xp = entry->xattr_head; xp != NULL; xp = xp->next)
- ;
-
if ((xp = (struct ae_xattr *)malloc(sizeof(struct ae_xattr))) == NULL)
- /* XXX Error XXX */
- return;
+ __archive_errx(1, "Out of memory");
if ((xp->name = strdup(name)) == NULL)
- /* XXX Error XXX */
- return;
+ __archive_errx(1, "Out of memory");
if ((xp->value = malloc(size)) != NULL) {
memcpy(xp->value, value, size);
diff --git a/Utilities/cmlibarchive/libarchive/archive_ppmd7.c b/Utilities/cmlibarchive/libarchive/archive_ppmd7.c
index fe0b0318cc..1aed922db6 100644
--- a/Utilities/cmlibarchive/libarchive/archive_ppmd7.c
+++ b/Utilities/cmlibarchive/libarchive/archive_ppmd7.c
@@ -126,6 +126,11 @@ static Bool Ppmd7_Alloc(CPpmd7 *p, UInt32 size, ISzAlloc *alloc)
{
if (p->Base == 0 || p->Size != size)
{
+ /* RestartModel() below assumes that p->Size >= UNIT_SIZE
+ (see the calculation of m->MinContext). */
+ if (size < UNIT_SIZE) {
+ return False;
+ }
Ppmd7_Free(p, alloc);
p->AlignOffset =
#ifdef PPMD_32BIT
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c
index f045b8fe79..a33ea4fd44 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_7zip.c
@@ -2153,6 +2153,9 @@ read_SubStreamsInfo(struct archive_read *a, struct _7z_substream_info *ss,
return (-1);
if (UMAX_ENTRY < f[i].numUnpackStreams)
return (-1);
+ if (unpack_streams > SIZE_MAX - UMAX_ENTRY) {
+ return (-1);
+ }
unpack_streams += (size_t)f[i].numUnpackStreams;
}
if ((p = header_bytes(a, 1)) == NULL)
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c
index c2ca85bd3a..b09db0e9a5 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_cpio.c
@@ -401,6 +401,11 @@ archive_read_format_cpio_read_header(struct archive_read *a,
/* If this is a symlink, read the link contents. */
if (archive_entry_filetype(entry) == AE_IFLNK) {
+ if (cpio->entry_bytes_remaining > 1024 * 1024) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Rejecting malformed cpio archive: symlink contents exceed 1 megabyte");
+ return (ARCHIVE_FATAL);
+ }
h = __archive_read_ahead(a,
(size_t)cpio->entry_bytes_remaining, NULL);
if (h == NULL)
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c
index 3628025c4e..c19614ad96 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_iso9660.c
@@ -1091,7 +1091,7 @@ choose_volume(struct archive_read *a, struct iso9660 *iso9660)
/* This condition is unlikely; by way of caution. */
vd = &(iso9660->joliet);
- skipsize = LOGICAL_BLOCK_SIZE * vd->location;
+ skipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location;
skipsize = __archive_read_consume(a, skipsize);
if (skipsize < 0)
return ((int)skipsize);
@@ -1129,7 +1129,7 @@ choose_volume(struct archive_read *a, struct iso9660 *iso9660)
&& iso9660->seenJoliet) {
/* Switch reading data from primary to joliet. */
vd = &(iso9660->joliet);
- skipsize = LOGICAL_BLOCK_SIZE * vd->location;
+ skipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location;
skipsize -= iso9660->current_position;
skipsize = __archive_read_consume(a, skipsize);
if (skipsize < 0)
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c
index 81d9652113..8c3be9a294 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_mtree.c
@@ -1342,7 +1342,7 @@ parse_line(struct archive_read *a, struct archive_entry *entry,
/* strsep() is not in C90, but strcspn() is. */
/* Taken from http://unixpapa.com/incnote/string.html */
static char *
-la_strsep(char **sp, char *sep)
+la_strsep(char **sp, const char *sep)
{
char *p, *s;
if (sp == NULL || *sp == NULL || **sp == '\0')
@@ -1385,12 +1385,12 @@ parse_device(dev_t *pdev, struct archive *a, char *val)
"Missing number");
return ARCHIVE_WARN;
}
- numbers[argc++] = (unsigned long)mtree_atol(&p);
- if (argc > MAX_PACK_ARGS) {
+ if (argc >= MAX_PACK_ARGS) {
archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT,
"Too many arguments");
return ARCHIVE_WARN;
}
+ numbers[argc++] = (unsigned long)mtree_atol(&p);
}
if (argc < 2) {
archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT,
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c
index c52c42988f..fc8153f5bd 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar.c
@@ -2127,6 +2127,12 @@ parse_codes(struct archive_read *a)
rar->range_dec.Stream = &rar->bytein;
__archive_ppmd7_functions.Ppmd7_Construct(&rar->ppmd7_context);
+ if (rar->dictionary_size == 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Invalid zero dictionary size");
+ return (ARCHIVE_FATAL);
+ }
+
if (!__archive_ppmd7_functions.Ppmd7_Alloc(&rar->ppmd7_context,
rar->dictionary_size, &g_szalloc))
{
@@ -2884,11 +2890,10 @@ copy_from_lzss_window(struct archive_read *a, const void **buffer,
}
windowoffs = lzss_offset_for_position(&rar->lzss, startpos);
- if(windowoffs + length <= lzss_size(&rar->lzss))
+ if(windowoffs + length <= lzss_size(&rar->lzss)) {
memcpy(&rar->unp_buffer[rar->unp_offset], &rar->lzss.window[windowoffs],
length);
- else
- {
+ } else if (length <= lzss_size(&rar->lzss)) {
firstpart = lzss_size(&rar->lzss) - windowoffs;
if (firstpart < 0) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
@@ -2900,9 +2905,14 @@ copy_from_lzss_window(struct archive_read *a, const void **buffer,
&rar->lzss.window[windowoffs], firstpart);
memcpy(&rar->unp_buffer[rar->unp_offset + firstpart],
&rar->lzss.window[0], length - firstpart);
- } else
+ } else {
memcpy(&rar->unp_buffer[rar->unp_offset],
&rar->lzss.window[windowoffs], length);
+ }
+ } else {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Bad RAR file data");
+ return (ARCHIVE_FATAL);
}
rar->unp_offset += length;
if (rar->unp_offset >= rar->unp_buffer_size)
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c
index 01d85cf6af..b0521a627c 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_tar.c
@@ -202,7 +202,7 @@ static int archive_read_format_tar_read_header(struct archive_read *,
struct archive_entry *);
static int checksum(struct archive_read *, const void *);
static int pax_attribute(struct archive_read *, struct tar *,
- struct archive_entry *, char *key, char *value);
+ struct archive_entry *, const char *key, const char *value);
static int pax_header(struct archive_read *, struct tar *,
struct archive_entry *, char *attr);
static void pax_time(const char *, int64_t *sec, long *nanos);
@@ -1664,7 +1664,7 @@ pax_header(struct archive_read *a, struct tar *tar,
static int
pax_attribute_xattr(struct archive_entry *entry,
- char *name, char *value)
+ const char *name, const char *value)
{
char *name_decoded;
void *value_decoded;
@@ -1710,7 +1710,7 @@ pax_attribute_xattr(struct archive_entry *entry,
*/
static int
pax_attribute(struct archive_read *a, struct tar *tar,
- struct archive_entry *entry, char *key, char *value)
+ struct archive_entry *entry, const char *key, const char *value)
{
int64_t s;
long n;
diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c
index 1399e07667..c50ba84ea8 100644
--- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c
+++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_zip.c
@@ -181,6 +181,14 @@ struct zip {
char init_decryption;
/* Decryption buffer. */
+ /*
+ * The decrypted data starts at decrypted_ptr and
+ * extends for decrypted_bytes_remaining. Decryption
+ * adds new data to the end of this block, data is returned
+ * to clients from the beginning. When the block hits the
+ * end of decrypted_buffer, it has to be shuffled back to
+ * the beginning of the buffer.
+ */
unsigned char *decrypted_buffer;
unsigned char *decrypted_ptr;
size_t decrypted_buffer_size;
@@ -1293,8 +1301,9 @@ zip_read_data_deflate(struct archive_read *a, const void **buff,
if (zip->tctx_valid || zip->cctx_valid) {
if (zip->decrypted_bytes_remaining < (size_t)bytes_avail) {
- size_t buff_remaining = zip->decrypted_buffer_size
- - (zip->decrypted_ptr - zip->decrypted_buffer);
+ size_t buff_remaining =
+ (zip->decrypted_buffer + zip->decrypted_buffer_size)
+ - (zip->decrypted_ptr + zip->decrypted_bytes_remaining);
if (buff_remaining > (size_t)bytes_avail)
buff_remaining = (size_t)bytes_avail;
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c b/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c
index 800aa893f4..da76c54db5 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_disk_windows.c
@@ -468,9 +468,17 @@ permissive_name_w(struct archive_write_disk *a)
return (-1);
archive_wstring_ensure(&(a->_name_data), 4 + l + 1 + wcslen(wn) + 1);
a->name = a->_name_data.s;
- /* Prepend "\\?\" and drive name. */
- archive_wstrncpy(&(a->_name_data), L"\\\\?\\", 4);
- archive_wstrncat(&(a->_name_data), wsp, l);
+ /* Prepend "\\?\" and drive name if not already added. */
+ if (l > 3 && wsp[0] == L'\\' && wsp[1] == L'\\' &&
+ wsp[2] == L'?' && wsp[3] == L'\\')
+ {
+ archive_wstrncpy(&(a->_name_data), wsp, l);
+ }
+ else
+ {
+ archive_wstrncpy(&(a->_name_data), L"\\\\?\\", 4);
+ archive_wstrncat(&(a->_name_data), wsp, l);
+ }
archive_wstrncat(&(a->_name_data), L"\\", 1);
archive_wstrcat(&(a->_name_data), wn);
a->name = a->_name_data.s;
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_filter.3 b/Utilities/cmlibarchive/libarchive/archive_write_filter.3
index 869dc46b69..e1d1891506 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_filter.3
+++ b/Utilities/cmlibarchive/libarchive/archive_write_filter.3
@@ -43,6 +43,7 @@
.Nm archive_write_add_filter_program ,
.Nm archive_write_add_filter_uuencode ,
.Nm archive_write_add_filter_xz
+.Nd functions enabling output filters
.Sh LIBRARY
Streaming Archive Library (libarchive, -larchive)
.Sh SYNOPSIS
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_gnutar.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_gnutar.c
index 647079de63..1d635d2dc3 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_gnutar.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_gnutar.c
@@ -467,7 +467,7 @@ archive_write_gnutar_header(struct archive_write *a,
}
}
if (gnutar->linkname_length > GNUTAR_linkname_size) {
- size_t todo = gnutar->linkname_length;
+ size_t length = gnutar->linkname_length + 1;
struct archive_entry *temp = archive_entry_new2(&a->archive);
/* Uname/gname here don't really matter since no one reads them;
@@ -476,7 +476,7 @@ archive_write_gnutar_header(struct archive_write *a,
archive_entry_set_gname(temp, "wheel");
archive_entry_set_pathname(temp, "././@LongLink");
- archive_entry_set_size(temp, gnutar->linkname_length + 1);
+ archive_entry_set_size(temp, length);
ret = archive_format_gnutar_header(a, buff, temp, 'K');
if (ret < ARCHIVE_WARN)
goto exit_write_header;
@@ -484,11 +484,12 @@ archive_write_gnutar_header(struct archive_write *a,
if(ret < ARCHIVE_WARN)
goto exit_write_header;
archive_entry_free(temp);
- /* Write as many 512 bytes blocks as needed to write full name. */
- ret = __archive_write_output(a, gnutar->linkname, todo);
+ /* Write name and trailing null byte. */
+ ret = __archive_write_output(a, gnutar->linkname, length);
if(ret < ARCHIVE_WARN)
goto exit_write_header;
- ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)todo));
+ /* Pad to 512 bytes */
+ ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)length));
if (ret < ARCHIVE_WARN)
goto exit_write_header;
}
@@ -496,7 +497,7 @@ archive_write_gnutar_header(struct archive_write *a,
/* If pathname is longer than 100 chars we need to add an 'L' header. */
if (gnutar->pathname_length > GNUTAR_name_size) {
const char *pathname = gnutar->pathname;
- size_t todo = gnutar->pathname_length;
+ size_t length = gnutar->pathname_length + 1;
struct archive_entry *temp = archive_entry_new2(&a->archive);
/* Uname/gname here don't really matter since no one reads them;
@@ -505,7 +506,7 @@ archive_write_gnutar_header(struct archive_write *a,
archive_entry_set_gname(temp, "wheel");
archive_entry_set_pathname(temp, "././@LongLink");
- archive_entry_set_size(temp, gnutar->pathname_length + 1);
+ archive_entry_set_size(temp, length);
ret = archive_format_gnutar_header(a, buff, temp, 'L');
if (ret < ARCHIVE_WARN)
goto exit_write_header;
@@ -513,11 +514,12 @@ archive_write_gnutar_header(struct archive_write *a,
if(ret < ARCHIVE_WARN)
goto exit_write_header;
archive_entry_free(temp);
- /* Write as many 512 bytes blocks as needed to write full name. */
- ret = __archive_write_output(a, pathname, todo);
+ /* Write pathname + trailing null byte. */
+ ret = __archive_write_output(a, pathname, length);
if(ret < ARCHIVE_WARN)
goto exit_write_header;
- ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)todo));
+ /* Pad to multiple of 512 bytes. */
+ ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)length));
if (ret < ARCHIVE_WARN)
goto exit_write_header;
}
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c
index 576f4c29f5..879a77695d 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_iso9660.c
@@ -6225,7 +6225,7 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
unsigned char *p;
size_t l;
int r;
- int ffmax, parent_len;
+ size_t ffmax, parent_len;
static const struct archive_rb_tree_ops rb_ops = {
isoent_cmp_node_joliet, isoent_cmp_key_joliet
};
@@ -6239,7 +6239,7 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
else
ffmax = 128;
- r = idr_start(a, idr, isoent->children.cnt, ffmax, 6, 2, &rb_ops);
+ r = idr_start(a, idr, isoent->children.cnt, (int)ffmax, 6, 2, &rb_ops);
if (r < 0)
return (r);
@@ -6252,7 +6252,7 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
int ext_off, noff, weight;
size_t lt;
- if ((int)(l = np->file->basename_utf16.length) > ffmax)
+ if ((l = np->file->basename_utf16.length) > ffmax)
l = ffmax;
p = malloc((l+1)*2);
@@ -6285,7 +6285,7 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
/*
* Get a length of MBS of a full-pathname.
*/
- if ((int)np->file->basename_utf16.length > ffmax) {
+ if (np->file->basename_utf16.length > ffmax) {
if (archive_strncpy_l(&iso9660->mbs,
(const char *)np->identifier, l,
iso9660->sconv_from_utf16be) != 0 &&
@@ -6302,7 +6302,9 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
/* If a length of full-pathname is longer than 240 bytes,
* it violates Joliet extensions regulation. */
- if (parent_len + np->mb_len > 240) {
+ if (parent_len > 240
+ || np->mb_len > 240
+ || parent_len + np->mb_len > 240) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"The regulation of Joliet extensions;"
" A length of a full-pathname of `%s' is "
@@ -6314,11 +6316,11 @@ isoent_gen_joliet_identifier(struct archive_write *a, struct isoent *isoent,
/* Make an offset of the number which is used to be set
* hexadecimal number to avoid duplicate identifier. */
- if ((int)l == ffmax)
+ if (l == ffmax)
noff = ext_off - 6;
- else if ((int)l == ffmax-2)
+ else if (l == ffmax-2)
noff = ext_off - 4;
- else if ((int)l == ffmax-4)
+ else if (l == ffmax-4)
noff = ext_off - 2;
else
noff = ext_off;
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_options.3 b/Utilities/cmlibarchive/libarchive/archive_write_set_options.3
index ce7ed89c91..aeb7a18486 100644
--- a/Utilities/cmlibarchive/libarchive/archive_write_set_options.3
+++ b/Utilities/cmlibarchive/libarchive/archive_write_set_options.3
@@ -32,7 +32,7 @@
.Nm archive_write_set_format_option ,
.Nm archive_write_set_option ,
.Nm archive_write_set_options
-.Nd functions controlling options for reading archives
+.Nd functions controlling options for writing archives
.Sh LIBRARY
Streaming Archive Library (libarchive, -larchive)
.Sh SYNOPSIS
diff --git a/Utilities/cmlibarchive/libarchive/libarchive-formats.5 b/Utilities/cmlibarchive/libarchive/libarchive-formats.5
index e619fe540c..9cec760052 100644
--- a/Utilities/cmlibarchive/libarchive/libarchive-formats.5
+++ b/Utilities/cmlibarchive/libarchive/libarchive-formats.5
@@ -65,7 +65,6 @@ Later variants have extended this by either appropriating undefined
areas of the header record, extending the header to multiple records,
or by storing special entries that modify the interpretation of
subsequent entries.
-.Pp
.Bl -tag -width indent
.It Cm gnutar
The
diff --git a/Utilities/cmlibarchive/libarchive/libarchive_changes.3 b/Utilities/cmlibarchive/libarchive/libarchive_changes.3
index bacd6e123a..881a67cdd4 100644
--- a/Utilities/cmlibarchive/libarchive/libarchive_changes.3
+++ b/Utilities/cmlibarchive/libarchive/libarchive_changes.3
@@ -28,7 +28,7 @@
.Dt LIBARCHIVE_CHANGES 3
.Os
.Sh NAME
-.Nm changes in libarchive interface
+.Nd changes in libarchive interface
.\"
.Sh CHANGES IN LIBARCHIVE 3
This page describes user-visible changes in libarchive3, and lists