diff --git a/release/src-rt-6.x.4708/router/libzip/.github/workflows/bsd.yml b/release/src-rt-6.x.4708/router/libzip/.github/workflows/bsd.yml new file mode 100644 index 0000000000..258f656e46 --- /dev/null +++ b/release/src-rt-6.x.4708/router/libzip/.github/workflows/bsd.yml @@ -0,0 +1,23 @@ +name: BSD +on: [push] +jobs: + NetBSD: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v4 + - name: NetBSD test + uses: vmactions/netbsd-vm@v1 + with: + usesh: true + copyback: false + prepare: | + /usr/sbin/pkg_add cmake zstd py313-pip + /usr/pkg/bin/pip-3.13 install nihtest + # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#adding-a-system-path + echo "/usr/pkg/bin" >> "$GITHUB_PATH" + run: | + cmake -E make_directory ${{runner.workspace}}/build + cmake ${{ matrix.cmake_extra }} ${{github.workspace}} + cmake --build . --config Release + ctest --output-on-failure -V -C Release diff --git a/release/src-rt-6.x.4708/router/libzip/CMakeLists.txt b/release/src-rt-6.x.4708/router/libzip/CMakeLists.txt index 23e0f0fd85..472a7a2fef 100644 --- a/release/src-rt-6.x.4708/router/libzip/CMakeLists.txt +++ b/release/src-rt-6.x.4708/router/libzip/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5.0) +cmake_minimum_required(VERSION 3.10) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) if (${CMAKE_VERSION} VERSION_LESS "3.17.0") @@ -6,7 +6,7 @@ if (${CMAKE_VERSION} VERSION_LESS "3.17.0") endif() project(libzip - VERSION 1.11.2 + VERSION 1.11.3 LANGUAGES C) if(NOT libzip_VERSION_PATCH) @@ -122,6 +122,7 @@ check_function_exists(fileno HAVE_FILENO) check_function_exists(fseeko HAVE_FSEEKO) check_function_exists(ftello HAVE_FTELLO) check_function_exists(getprogname HAVE_GETPROGNAME) +check_function_exists(GetSecurityInfo HAVE_GETSECURITYINFO) check_symbol_exists(localtime_r time.h HAVE_LOCALTIME_R) check_symbol_exists(localtime_s time.h HAVE_LOCALTIME_S) check_function_exists(memcpy_s HAVE_MEMCPY_S) @@ -192,10 +193,6 @@ check_c_source_compiles("#include #include int main(int argc, char *argv[]) { unsigned long x = FICLONERANGE; }" HAVE_FICLONERANGE) -check_c_source_compiles(" -int foo(char * _Nullable bar); -int main(int argc, char *argv[]) { }" HAVE_NULLABLE) - test_big_endian(WORDS_BIGENDIAN) find_package(ZLIB 1.1.2 REQUIRED) @@ -458,13 +455,6 @@ elseif(LONG_LONG_LIBZIP EQUAL 8) set(ZIP_UINT64_T "unsigned long long") endif() -if(HAVE_NULLABLE) - set(ZIP_NULLABLE_DEFINES) -else() - set(ZIP_NULLABLE_DEFINES "#define _Nullable -#define _Nonnull") -endif() - # write out config file configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${PROJECT_BINARY_DIR}/config.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zipconf.h.in ${PROJECT_BINARY_DIR}/zipconf.h) diff --git a/release/src-rt-6.x.4708/router/libzip/NEWS.md b/release/src-rt-6.x.4708/router/libzip/NEWS.md index d2b1e73d78..b3bf108081 100644 --- a/release/src-rt-6.x.4708/router/libzip/NEWS.md +++ b/release/src-rt-6.x.4708/router/libzip/NEWS.md @@ -1,3 +1,10 @@ +# 1.11.3 [2025-01-20] + +* Report read error for corrupted encrypted file data. +* Avoid unnecessary seeks when writing archive. +* Don't hardcode `_Nullable` support in `zip.h` to allow it to be used with different compilers. +* Improve check for GetSecurityInformation availability on Windows. + # 1.11.2 [2024-10-31] * Fix performance regression in `zip_stat` introduced in 1.11. diff --git a/release/src-rt-6.x.4708/router/libzip/THANKS b/release/src-rt-6.x.4708/router/libzip/THANKS index b582681acf..d36809cdf8 100644 --- a/release/src-rt-6.x.4708/router/libzip/THANKS +++ b/release/src-rt-6.x.4708/router/libzip/THANKS @@ -32,6 +32,7 @@ ChrisAm1224 Chris Nehren Christoph Cullmann Christoph M. Becker +Corentin Schreiber Coverity cryi ctenter-scs @@ -135,6 +136,7 @@ Roland Ortloff Rosen Penev Rudi Heitbaum Ryan Burns +Sam James Sam Sappenfield Sandro Mani scribam @@ -146,6 +148,7 @@ Shimi Simon Talbot SpaceIm Stephen Bryant +sxkan Tabata Shintaro takase1121 Tarmo Pikaro diff --git a/release/src-rt-6.x.4708/router/libzip/config.h.in b/release/src-rt-6.x.4708/router/libzip/config.h.in index 90a3242852..07242da636 100644 --- a/release/src-rt-6.x.4708/router/libzip/config.h.in +++ b/release/src-rt-6.x.4708/router/libzip/config.h.in @@ -32,6 +32,7 @@ #cmakedefine HAVE_FSEEKO #cmakedefine HAVE_FTELLO #cmakedefine HAVE_GETPROGNAME +#cmakedefine HAVE_GETSECURITYINFO #cmakedefine HAVE_GNUTLS #cmakedefine HAVE_LIBBZ2 #cmakedefine HAVE_LIBLZMA @@ -41,7 +42,6 @@ #cmakedefine HAVE_MEMCPY_S #cmakedefine HAVE_MBEDTLS #cmakedefine HAVE_MKSTEMP -#cmakedefine HAVE_NULLABLE #cmakedefine HAVE_OPENSSL #cmakedefine HAVE_SETMODE #cmakedefine HAVE_SNPRINTF diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zip.h b/release/src-rt-6.x.4708/router/libzip/lib/zip.h index 14064062f5..c2a8a8b469 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zip.h +++ b/release/src-rt-6.x.4708/router/libzip/lib/zip.h @@ -34,6 +34,15 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#if defined(__has_feature) + #if !__has_feature(nullability) + #define _Nullable + #define _Nonnull + #endif +#else + #define _Nullable + #define _Nonnull +#endif #ifdef __cplusplus extern "C" { diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_bzip2.c b/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_bzip2.c index 1818039e84..d5311a7218 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_bzip2.c +++ b/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_bzip2.c @@ -208,11 +208,11 @@ input(void *ud, zip_uint8_t *data, zip_uint64_t length) { } -static void -end_of_input(void *ud) { +static bool end_of_input(void *ud) { struct ctx *ctx = (struct ctx *)ud; ctx->end_of_input = true; + return ctx->zstr.avail_in != 0; } diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_deflate.c b/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_deflate.c index 5ab879dfef..402b7e8bc5 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_deflate.c +++ b/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_deflate.c @@ -196,11 +196,11 @@ input(void *ud, zip_uint8_t *data, zip_uint64_t length) { } -static void -end_of_input(void *ud) { +static bool end_of_input(void *ud) { struct ctx *ctx = (struct ctx *)ud; ctx->end_of_input = true; + return ctx->zstr.avail_in != 0; } diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_xz.c b/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_xz.c index b0413e013c..adadc1cb5a 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_xz.c +++ b/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_xz.c @@ -302,11 +302,11 @@ input(void *ud, zip_uint8_t *data, zip_uint64_t length) { } -static void -end_of_input(void *ud) { +static bool end_of_input(void *ud) { struct ctx *ctx = (struct ctx *)ud; ctx->end_of_input = true; + return ctx->zstr.avail_in != 0; } diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_zstd.c b/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_zstd.c index b2aa2132d0..21bb2498bb 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_zstd.c +++ b/release/src-rt-6.x.4708/router/libzip/lib/zip_algorithm_zstd.c @@ -211,11 +211,11 @@ input(void *ud, zip_uint8_t *data, zip_uint64_t length) { } -static void -end_of_input(void *ud) { +static bool end_of_input(void *ud) { struct ctx *ctx = (struct ctx *)ud; ctx->end_of_input = true; + return ctx->in.pos != ctx->in.size; } diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zip_close.c b/release/src-rt-6.x.4708/router/libzip/lib/zip_close.c index 4313592cda..6948c0e25b 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zip_close.c +++ b/release/src-rt-6.x.4708/router/libzip/lib/zip_close.c @@ -295,8 +295,7 @@ zip_close(zip_t *za) { } -static int -add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) { +static int add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) { zip_int64_t offstart, offdata, offend, data_length; zip_stat_t st; zip_file_attributes_t attributes; @@ -305,19 +304,24 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) { int is_zip64; zip_flags_t flags; bool needs_recompress, needs_decompress, needs_crc, needs_compress, needs_reencrypt, needs_decrypt, needs_encrypt; + bool have_dos_time, dirent_changed; + time_t mtime_before_copy; if (zip_source_stat(src, &st) < 0) { zip_error_set_from_source(&za->error, src); return -1; } + de->bitflags &= ~ZIP_GPBF_DATA_DESCRIPTOR; + if ((st.valid & ZIP_STAT_COMP_METHOD) == 0) { st.valid |= ZIP_STAT_COMP_METHOD; st.comp_method = ZIP_CM_STORE; } - if (ZIP_CM_IS_DEFAULT(de->comp_method) && st.comp_method != ZIP_CM_STORE) + if (ZIP_CM_IS_DEFAULT(de->comp_method) && st.comp_method != ZIP_CM_STORE) { de->comp_method = st.comp_method; + } else if (de->comp_method == ZIP_CM_STORE && (st.valid & ZIP_STAT_SIZE)) { st.valid |= ZIP_STAT_COMP_SIZE; st.comp_size = st.size; @@ -372,14 +376,30 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) { } } - if ((offstart = zip_source_tell_write(za->src)) < 0) { - zip_error_set_from_source(&za->error, za->src); - return -1; + if ((de->changed & ZIP_DIRENT_LAST_MOD) == 0) { + int ret2 = zip_source_get_dos_time(src, &de->last_mod); + if (ret2 < 0) { + zip_error_set_from_source(&za->error, src); + return -1; + } + if (ret2 == 1) { + have_dos_time = true; + } + else { + if (st.valid & ZIP_STAT_MTIME) { + mtime_before_copy = st.mtime; + } + else { + time(&mtime_before_copy); + } + if (_zip_u2d_time(mtime_before_copy, &de->last_mod, &za->error) < 0) { + return -1; + } + } } - /* as long as we don't support non-seekable output, clear data descriptor bit */ - de->bitflags &= (zip_uint16_t)~ZIP_GPBF_DATA_DESCRIPTOR; - if ((is_zip64 = _zip_dirent_write(za, de, flags)) < 0) { + if ((offstart = zip_source_tell_write(za->src)) < 0) { + zip_error_set_from_source(&za->error, za->src); return -1; } @@ -485,9 +505,24 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) { src_final = src_tmp; } + if (!ZIP_WANT_TORRENTZIP(za)) { + if (zip_source_get_file_attributes(src_final, &attributes) != 0) { + zip_error_set_from_source(&za->error, src_final); + zip_source_free(src_final); + return -1; + } + _zip_dirent_apply_attributes(de, &attributes, (flags & ZIP_FL_FORCE_ZIP64) != 0, changed); + } + + /* as long as we don't support non-seekable output, clear data descriptor bit */ + if ((is_zip64 = _zip_dirent_write(za, de, flags)) < 0) { + zip_source_free(src_final); + return -1; + } if ((offdata = zip_source_tell_write(za->src)) < 0) { zip_error_set_from_source(&za->error, za->src); + zip_source_free(src_final); return -1; } @@ -498,9 +533,11 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) { ret = -1; } - if (zip_source_get_file_attributes(src_final, &attributes) != 0) { - zip_error_set_from_source(&za->error, src_final); - ret = -1; + if (!ZIP_WANT_TORRENTZIP(za)) { + if (zip_source_get_file_attributes(src_final, &attributes) != 0) { + zip_error_set_from_source(&za->error, src_final); + ret = -1; + } } zip_source_free(src_final); @@ -514,57 +551,51 @@ add_data(zip_t *za, zip_source_t *src, zip_dirent_t *de, zip_uint32_t changed) { return -1; } - if (zip_source_seek_write(za->src, offstart, SEEK_SET) < 0) { - zip_error_set_from_source(&za->error, za->src); - return -1; - } - if ((st.valid & (ZIP_STAT_COMP_METHOD | ZIP_STAT_CRC | ZIP_STAT_SIZE)) != (ZIP_STAT_COMP_METHOD | ZIP_STAT_CRC | ZIP_STAT_SIZE)) { zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); return -1; } - if ((de->changed & ZIP_DIRENT_LAST_MOD) == 0) { - int ret2 = zip_source_get_dos_time(src, &de->last_mod); - if (ret2 < 0) { - zip_error_set_from_source(&za->error, src); - return -1; - } - if (ret2 == 0) { - time_t mtime; - if (st.valid & ZIP_STAT_MTIME) { - mtime = st.mtime; - } - else { - time(&mtime); - } - if (_zip_u2d_time(mtime, &de->last_mod, &za->error) < 0) { - return -1; - } - } - } + dirent_changed = ZIP_CM_ACTUAL(de->comp_method) != st.comp_method || de->crc != st.crc || de->uncomp_size != st.size || de->comp_size != (zip_uint64_t)(offend - offdata); de->comp_method = st.comp_method; de->crc = st.crc; de->uncomp_size = st.size; de->comp_size = (zip_uint64_t)(offend - offdata); - _zip_dirent_apply_attributes(de, &attributes, (flags & ZIP_FL_FORCE_ZIP64) != 0, changed); - if (ZIP_WANT_TORRENTZIP(za)) { - zip_dirent_torrentzip_normalize(de); + if (!ZIP_WANT_TORRENTZIP(za)) { + dirent_changed |= _zip_dirent_apply_attributes(de, &attributes, (flags & ZIP_FL_FORCE_ZIP64) != 0, changed); + + if ((de->changed & ZIP_DIRENT_LAST_MOD) == 0 && !have_dos_time) { + if (st.valid & ZIP_STAT_MTIME) { + if (st.mtime != mtime_before_copy) { + if (_zip_u2d_time(st.mtime, &de->last_mod, &za->error) < 0) { + return -1; + } + dirent_changed = true; + } + } + } } - if ((ret = _zip_dirent_write(za, de, flags)) < 0) - return -1; + if (dirent_changed) { + if (zip_source_seek_write(za->src, offstart, SEEK_SET) < 0) { + zip_error_set_from_source(&za->error, za->src); + return -1; + } - if (is_zip64 != ret) { - /* Zip64 mismatch between preliminary file header written before data and final file header written afterwards */ - zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); - return -1; - } + if ((ret = _zip_dirent_write(za, de, flags)) < 0) + return -1; - if (zip_source_seek_write(za->src, offend, SEEK_SET) < 0) { - zip_error_set_from_source(&za->error, za->src); - return -1; + if (is_zip64 != ret) { + /* Zip64 mismatch between preliminary file header written before data and final file header written afterwards */ + zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); + return -1; + } + + if (zip_source_seek_write(za->src, offend, SEEK_SET) < 0) { + zip_error_set_from_source(&za->error, za->src); + return -1; + } } if (de->bitflags & ZIP_GPBF_DATA_DESCRIPTOR) { diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zip_dirent.c b/release/src-rt-6.x.4708/router/libzip/lib/zip_dirent.c index 24bc6abf9c..7476ac00d3 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zip_dirent.c +++ b/release/src-rt-6.x.4708/router/libzip/lib/zip_dirent.c @@ -968,7 +968,7 @@ _zip_dirent_write(zip_t *za, zip_dirent_t *de, zip_flags_t flags) { _zip_buffer_put_16(buffer, ZIP_CM_WINZIP_AES); } else { - _zip_buffer_put_16(buffer, (zip_uint16_t)de->comp_method); + _zip_buffer_put_16(buffer, (zip_uint16_t)ZIP_CM_ACTUAL(de->comp_method)); } if (ZIP_WANT_TORRENTZIP(za)) { @@ -1190,52 +1190,75 @@ _zip_u2d_time(time_t intime, zip_dostime_t *dtime, zip_error_t *ze) { } -void -_zip_dirent_apply_attributes(zip_dirent_t *de, zip_file_attributes_t *attributes, bool force_zip64, zip_uint32_t changed) { +bool _zip_dirent_apply_attributes(zip_dirent_t *de, zip_file_attributes_t *attributes, bool force_zip64, zip_uint32_t changed) { zip_uint16_t length; + bool has_changed = false; if (attributes->valid & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS) { zip_uint16_t mask = attributes->general_purpose_bit_mask & ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS_ALLOWED_MASK; - de->bitflags = (de->bitflags & ~mask) | (attributes->general_purpose_bit_flags & mask); + zip_uint16_t bitflags = (de->bitflags & ~mask) | (attributes->general_purpose_bit_flags & mask); + if (de->bitflags != bitflags) { + de->bitflags = bitflags; + has_changed = true; + } } if (attributes->valid & ZIP_FILE_ATTRIBUTES_ASCII) { - de->int_attrib = (de->int_attrib & ~0x1) | (attributes->ascii ? 1 : 0); + zip_uint16_t int_attrib = (de->int_attrib & ~0x1) | (attributes->ascii ? 1 : 0); + if (de->int_attrib != int_attrib) { + de->int_attrib = int_attrib; + has_changed = true; + } } /* manually set attributes are preferred over attributes provided by source */ if ((changed & ZIP_DIRENT_ATTRIBUTES) == 0 && (attributes->valid & ZIP_FILE_ATTRIBUTES_EXTERNAL_FILE_ATTRIBUTES)) { - de->ext_attrib = attributes->external_file_attributes; + if (de->ext_attrib != attributes->external_file_attributes) { + de->ext_attrib = attributes->external_file_attributes; + has_changed = true; + } } + zip_uint16_t version_needed; if (de->comp_method == ZIP_CM_LZMA) { - de->version_needed = 63; + version_needed = 63; } else if (de->encryption_method == ZIP_EM_AES_128 || de->encryption_method == ZIP_EM_AES_192 || de->encryption_method == ZIP_EM_AES_256) { - de->version_needed = 51; + version_needed = 51; } else if (de->comp_method == ZIP_CM_BZIP2) { - de->version_needed = 46; + version_needed = 46; } else if (force_zip64 || _zip_dirent_needs_zip64(de, 0)) { - de->version_needed = 45; + version_needed = 45; } else if (de->comp_method == ZIP_CM_DEFLATE || de->encryption_method == ZIP_EM_TRAD_PKWARE) { - de->version_needed = 20; + version_needed = 20; } else if ((length = _zip_string_length(de->filename)) > 0 && de->filename->raw[length - 1] == '/') { - de->version_needed = 20; + version_needed = 20; } else { - de->version_needed = 10; + version_needed = 10; } if (attributes->valid & ZIP_FILE_ATTRIBUTES_VERSION_NEEDED) { - de->version_needed = ZIP_MAX(de->version_needed, attributes->version_needed); + version_needed = ZIP_MAX(version_needed, attributes->version_needed); + } + + if (de->version_needed != version_needed) { + de->version_needed = version_needed; + has_changed = true; } - de->version_madeby = 63 | (de->version_madeby & 0xff00); + zip_int16_t version_madeby = 63 | (de->version_madeby & 0xff00); if ((changed & ZIP_DIRENT_ATTRIBUTES) == 0 && (attributes->valid & ZIP_FILE_ATTRIBUTES_HOST_SYSTEM)) { - de->version_madeby = (de->version_madeby & 0xff) | (zip_uint16_t)(attributes->host_system << 8); + version_madeby = (version_madeby & 0xff) | (zip_uint16_t)(attributes->host_system << 8); + } + if (de->version_madeby != version_madeby) { + de->version_madeby = version_madeby; + has_changed = true; } + + return has_changed; } @@ -1257,15 +1280,37 @@ zip_dirent_torrentzip_normalize(zip_dirent_t *de) { /* last_mod, extra_fields, and comment are normalized in zip_dirent_write() directly */ } -int -zip_dirent_check_consistency(zip_dirent_t *dirent) { - if (dirent->comp_method == ZIP_CM_STORE && dirent->comp_size != dirent->uncomp_size) { - return ZIP_ER_DETAIL_STORED_SIZE_MISMATCH; +int zip_dirent_check_consistency(zip_dirent_t *dirent) { + if (dirent->comp_method == ZIP_CM_STORE) { + zip_uint64_t header_size = 0; + switch (dirent->encryption_method) { + case ZIP_EM_NONE: + break; + case ZIP_EM_TRAD_PKWARE: + header_size = 12; + break; + case ZIP_EM_AES_128: + header_size = 20; + break; + case ZIP_EM_AES_192: + header_size = 24; + break; + case ZIP_EM_AES_256: + header_size = 28; + break; + + default: + return 0; + } + if (dirent->uncomp_size + header_size < dirent->uncomp_size || dirent->comp_size != dirent->uncomp_size + header_size) { + return ZIP_ER_DETAIL_STORED_SIZE_MISMATCH; + } } return 0; } -time_t zip_dirent_get_last_mod_mtime(zip_dirent_t *de) { +time_t +zip_dirent_get_last_mod_mtime(zip_dirent_t *de) { if (!de->last_mod_mtime_valid) { de->last_mod_mtime = _zip_d2u_time(&de->last_mod); de->last_mod_mtime_valid = true; diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zip_open.c b/release/src-rt-6.x.4708/router/libzip/lib/zip_open.c index 9dccad6190..aee0da0d2e 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zip_open.c +++ b/release/src-rt-6.x.4708/router/libzip/lib/zip_open.c @@ -207,7 +207,7 @@ _zip_open(zip_source_t *src, unsigned int flags, zip_error_t *error) { if ((cdir = _zip_find_central_dir(za, len)) == NULL) { _zip_error_copy(error, &za->error); - if (zip_error_code_zip(error) == ZIP_ER_NOZIP) { + if (zip_error_code_zip(&za->error) == ZIP_ER_NOZIP) { /* not a zip - find out if it's truncated */ if (_is_truncated_zip(src)) { zip_error_set(error, ZIP_ER_TRUNCATED_ZIP, 0); diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zip_source_buffer.c b/release/src-rt-6.x.4708/router/libzip/lib/zip_source_buffer.c index a680214a14..be5a9c4032 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zip_source_buffer.c +++ b/release/src-rt-6.x.4708/router/libzip/lib/zip_source_buffer.c @@ -340,6 +340,7 @@ buffer_clone(buffer_t *buffer, zip_uint64_t offset, zip_error_t *error) { fragment_offset = offset - buffer->fragment_offsets[fragment]; if (fragment_offset == 0) { + /* We can't be at beginning of fragment zero if offset > 0. */ fragment--; fragment_offset = buffer->fragments[fragment].length; } diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zip_source_compress.c b/release/src-rt-6.x.4708/router/libzip/lib/zip_source_compress.c index 54387ecaf8..333079616e 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zip_source_compress.c +++ b/release/src-rt-6.x.4708/router/libzip/lib/zip_source_compress.c @@ -44,6 +44,7 @@ struct context { bool can_store; bool is_stored; /* only valid if end_of_stream is true */ bool compress; + bool check_consistency; zip_int32_t method; zip_uint64_t size; @@ -86,11 +87,10 @@ static size_t implementations_size = sizeof(implementations) / sizeof(implementa static zip_source_t *compression_source_new(zip_t *za, zip_source_t *src, zip_int32_t method, bool compress, zip_uint32_t compression_flags); static zip_int64_t compress_callback(zip_source_t *, void *, void *, zip_uint64_t, zip_source_cmd_t); static void context_free(struct context *ctx); -static struct context *context_new(zip_int32_t method, bool compress, zip_uint32_t compression_flags, zip_compression_algorithm_t *algorithm); +static struct context *context_new(zip_int32_t method, bool compress, zip_uint32_t compression_flags, zip_compression_algorithm_t *algorithm, bool check_consistency); static zip_int64_t compress_read(zip_source_t *, struct context *, void *, zip_uint64_t); -zip_compression_algorithm_t * -_zip_get_compression_algorithm(zip_int32_t method, bool compress) { +zip_compression_algorithm_t *_zip_get_compression_algorithm(zip_int32_t method, bool compress) { size_t i; zip_uint16_t real_method = ZIP_CM_ACTUAL(method); @@ -108,16 +108,14 @@ _zip_get_compression_algorithm(zip_int32_t method, bool compress) { return NULL; } -ZIP_EXTERN int -zip_compression_method_supported(zip_int32_t method, int compress) { +ZIP_EXTERN int zip_compression_method_supported(zip_int32_t method, int compress) { if (method == ZIP_CM_STORE) { return 1; } return _zip_get_compression_algorithm(method, compress) != NULL; } -zip_source_t * -zip_source_compress(zip_t *za, zip_source_t *src, zip_int32_t method, zip_uint32_t compression_flags) { +zip_source_t *zip_source_compress(zip_t *za, zip_source_t *src, zip_int32_t method, zip_uint32_t compression_flags) { return compression_source_new(za, src, method, true, compression_flags); } @@ -127,8 +125,7 @@ zip_source_decompress(zip_t *za, zip_source_t *src, zip_int32_t method) { } -static zip_source_t * -compression_source_new(zip_t *za, zip_source_t *src, zip_int32_t method, bool compress, zip_uint32_t compression_flags) { +static zip_source_t *compression_source_new(zip_t *za, zip_source_t *src, zip_int32_t method, bool compress, zip_uint32_t compression_flags) { struct context *ctx; zip_source_t *s2; zip_compression_algorithm_t *algorithm = NULL; @@ -143,7 +140,7 @@ compression_source_new(zip_t *za, zip_source_t *src, zip_int32_t method, bool co return NULL; } - if ((ctx = context_new(method, compress, compression_flags, algorithm)) == NULL) { + if ((ctx = context_new(method, compress, compression_flags, algorithm, za->open_flags & ZIP_CHECKCONS)) == NULL) { zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return NULL; } @@ -157,8 +154,7 @@ compression_source_new(zip_t *za, zip_source_t *src, zip_int32_t method, bool co } -static struct context * -context_new(zip_int32_t method, bool compress, zip_uint32_t compression_flags, zip_compression_algorithm_t *algorithm) { +static struct context *context_new(zip_int32_t method, bool compress, zip_uint32_t compression_flags, zip_compression_algorithm_t *algorithm, bool check_consistency) { struct context *ctx; if ((ctx = (struct context *)malloc(sizeof(*ctx))) == NULL) { @@ -172,6 +168,7 @@ context_new(zip_int32_t method, bool compress, zip_uint32_t compression_flags, z ctx->end_of_input = false; ctx->end_of_stream = false; ctx->is_stored = false; + ctx->check_consistency = check_consistency; if ((ctx->ud = ctx->algorithm->allocate(ZIP_CM_ACTUAL(method), compression_flags, &ctx->error)) == NULL) { zip_error_fini(&ctx->error); @@ -228,7 +225,23 @@ compress_read(zip_source_t *src, struct context *ctx, void *data, zip_uint64_t l ctx->end_of_stream = true; if (!ctx->end_of_input) { - /* TODO: garbage after stream, or compression ended before all data read */ + n = zip_source_read(src, ctx->buffer, 1); + if (n < 0) { + zip_error_set_from_source(&ctx->error, src); + end = true; + break; + } + else if (n == 0) { + ctx->end_of_input = true; + n = ctx->algorithm->end_of_input(ctx->ud) ? 1 : 0; + } + + if (n > 0 && ctx->check_consistency) { + /* garbage after stream, or compression ended before all data read */ + zip_error_set(&ctx->error, ZIP_ER_INCONS, ZIP_ER_DETAIL_COMPRESSED_DATA_TRAILING_GARBAGE); + end = true; + break; + } } if (ctx->first_read < 0) { diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zip_source_file_stdio.c b/release/src-rt-6.x.4708/router/libzip/lib/zip_source_file_stdio.c index 0fb858f122..6e98517a81 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zip_source_file_stdio.c +++ b/release/src-rt-6.x.4708/router/libzip/lib/zip_source_file_stdio.c @@ -95,9 +95,11 @@ _zip_stdio_op_close(zip_source_file_context_t *ctx) { zip_int64_t _zip_stdio_op_read(zip_source_file_context_t *ctx, void *buf, zip_uint64_t len) { size_t i; +#if SIZE_MAX < ZIP_UINT64_MAX if (len > SIZE_MAX) { len = SIZE_MAX; } +#endif if ((i = fread(buf, 1, (size_t)len, ctx->f)) == 0) { if (ferror((FILE *)ctx->f)) { diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zip_source_file_win32_named.c b/release/src-rt-6.x.4708/router/libzip/lib/zip_source_file_win32_named.c index 811174205e..5219d6ac28 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zip_source_file_win32_named.c +++ b/release/src-rt-6.x.4708/router/libzip/lib/zip_source_file_win32_named.c @@ -33,13 +33,6 @@ #include "zip_source_file_win32.h" -/* ACL is not available when targeting the games API partition */ -#if defined(WINAPI_FAMILY_PARTITION) && defined(WINAPI_PARTITION_GAMES) -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_GAMES) -#define ACL_UNSUPPORTED -#endif -#endif - static zip_int64_t _zip_win32_named_op_commit_write(zip_source_file_context_t *ctx); static zip_int64_t _zip_win32_named_op_create_temp_output(zip_source_file_context_t *ctx); static bool _zip_win32_named_op_open(zip_source_file_context_t *ctx); @@ -106,29 +99,24 @@ _zip_win32_named_op_create_temp_output(zip_source_file_context_t *ctx) { zip_uint32_t value, i; HANDLE th = INVALID_HANDLE_VALUE; - PSECURITY_DESCRIPTOR psd = NULL; PSECURITY_ATTRIBUTES psa = NULL; + PSECURITY_DESCRIPTOR psd = NULL; +#ifdef HAVE_GETSECURITYINFO SECURITY_ATTRIBUTES sa; - SECURITY_INFORMATION si; - DWORD success; - PACL dacl = NULL; +#endif char *tempname = NULL; size_t tempname_size = 0; +#ifdef HAVE_GETSECURITYINFO if ((HANDLE)ctx->f != INVALID_HANDLE_VALUE && GetFileType((HANDLE)ctx->f) == FILE_TYPE_DISK) { - si = DACL_SECURITY_INFORMATION | UNPROTECTED_DACL_SECURITY_INFORMATION; - #ifdef ACL_UNSUPPORTED - success = ERROR_NOT_SUPPORTED; - #else - success = GetSecurityInfo((HANDLE)ctx->f, SE_FILE_OBJECT, si, NULL, NULL, &dacl, NULL, &psd); - #endif - if (success == ERROR_SUCCESS) { + if (GetSecurityInfo((HANDLE)ctx->f, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION | UNPROTECTED_DACL_SECURITY_INFORMATION, NULL, NULL, NULL, NULL, &psd) == ERROR_SUCCESS) { sa.nLength = sizeof(SECURITY_ATTRIBUTES); sa.bInheritHandle = FALSE; sa.lpSecurityDescriptor = psd; psa = &sa; } } +#endif #ifndef MS_UWP value = GetTickCount(); diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zip_source_get_file_attributes.c b/release/src-rt-6.x.4708/router/libzip/lib/zip_source_get_file_attributes.c index 209e39f506..59c064fe0f 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zip_source_get_file_attributes.c +++ b/release/src-rt-6.x.4708/router/libzip/lib/zip_source_get_file_attributes.c @@ -39,8 +39,7 @@ zip_file_attributes_init(zip_file_attributes_t *attributes) { attributes->version = 1; } -int -zip_source_get_file_attributes(zip_source_t *src, zip_file_attributes_t *attributes) { +int zip_source_get_file_attributes(zip_source_t *src, zip_file_attributes_t *attributes) { if (src->source_closed) { return -1; } diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zip_source_pkware_encode.c b/release/src-rt-6.x.4708/router/libzip/lib/zip_source_pkware_encode.c index fed76115bf..26e1ce7940 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zip_source_pkware_encode.c +++ b/release/src-rt-6.x.4708/router/libzip/lib/zip_source_pkware_encode.c @@ -198,8 +198,10 @@ pkware_encrypt(zip_source_t *src, void *ud, void *data, zip_uint64_t length, zip zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); return -1; } - attributes->valid |= ZIP_FILE_ATTRIBUTES_VERSION_NEEDED; + attributes->valid |= ZIP_FILE_ATTRIBUTES_VERSION_NEEDED | ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS; attributes->version_needed = 20; + attributes->general_purpose_bit_flags = ZIP_GPBF_DATA_DESCRIPTOR; + attributes->general_purpose_bit_mask = ZIP_GPBF_DATA_DESCRIPTOR; return 0; } diff --git a/release/src-rt-6.x.4708/router/libzip/lib/zipint.h b/release/src-rt-6.x.4708/router/libzip/lib/zipint.h index e22d74c21d..7f6990ffed 100644 --- a/release/src-rt-6.x.4708/router/libzip/lib/zipint.h +++ b/release/src-rt-6.x.4708/router/libzip/lib/zipint.h @@ -102,7 +102,8 @@ /* according to unzip-6.0's zipinfo.c, this corresponds to a directory with rwx permissions for everyone */ #define ZIP_EXT_ATTRIB_DEFAULT_DIR (0040777u << 16) -#define ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS_ALLOWED_MASK 0x0836 +/* Allowed: Encryption specific bits, data descriptor, compression specific, UTF-8 filename */ +#define ZIP_FILE_ATTRIBUTES_GENERAL_PURPOSE_BIT_FLAGS_ALLOWED_MASK 0x083e #define ZIP_MAX(a, b) ((a) > (b) ? (a) : (b)) #define ZIP_MIN(a, b) ((a) < (b) ? (a) : (b)) @@ -152,7 +153,7 @@ struct zip_compression_algorithm { bool (*input)(void *ctx, zip_uint8_t *data, zip_uint64_t length); /* all input data has been provided */ - void (*end_of_input)(void *ctx); + bool (*end_of_input)(void *ctx); /* process input data, writing to data, which has room for length bytes, update length to number of bytes written */ zip_compression_status_t (*process)(void *ctx, zip_uint8_t *data, zip_uint64_t *length); @@ -241,6 +242,7 @@ extern const int _zip_err_details_count; #define ZIP_ER_DETAIL_EOCD64_LOCATOR_MISMATCH 22 /* G EOCD64 and EOCD64 locator do not match */ #define ZIP_ER_DETAIL_UTF8_FILENAME_MISMATCH 23 /* E UTF-8 filename is ASCII and doesn't match filename */ #define ZIP_ER_DETAIL_UTF8_COMMENT_MISMATCH 24 /* E UTF-8 comment is ASCII and doesn't match comment */ +#define ZIP_ER_DETAIL_COMPRESSED_DATA_TRAILING_GARBAGE 25 /* G garbage at end of compressed data */ /* directory entry: general purpose bit flags */ @@ -552,7 +554,7 @@ zip_int64_t _zip_cdir_write(zip_t *za, const zip_filelist_t *filelist, zip_uint6 time_t _zip_d2u_time(const zip_dostime_t*); void _zip_deregister_source(zip_t *za, zip_source_t *src); -void _zip_dirent_apply_attributes(zip_dirent_t *, zip_file_attributes_t *, bool, zip_uint32_t); +bool _zip_dirent_apply_attributes(zip_dirent_t *, zip_file_attributes_t *, bool, zip_uint32_t); int zip_dirent_check_consistency(zip_dirent_t *dirent); zip_dirent_t *_zip_dirent_clone(const zip_dirent_t *); void _zip_dirent_free(zip_dirent_t *); diff --git a/release/src-rt-6.x.4708/router/libzip/man/CMakeLists.txt b/release/src-rt-6.x.4708/router/libzip/man/CMakeLists.txt index fe3f091f7a..14173e0174 100644 --- a/release/src-rt-6.x.4708/router/libzip/man/CMakeLists.txt +++ b/release/src-rt-6.x.4708/router/libzip/man/CMakeLists.txt @@ -17,6 +17,7 @@ set(MAN_PAGES zip_error_get_sys_type.3 zip_error_init.3 zip_error_set.3 + zip_error_set_from_source.3 zip_error_strerror.3 zip_error_system_type.3 zip_error_to_data.3 diff --git a/release/src-rt-6.x.4708/router/libzip/man/zip_error_set_from_source.html b/release/src-rt-6.x.4708/router/libzip/man/zip_error_set_from_source.html new file mode 100644 index 0000000000..17f0a719af --- /dev/null +++ b/release/src-rt-6.x.4708/router/libzip/man/zip_error_set_from_source.html @@ -0,0 +1,103 @@ + + + + + + + ZIP_ERROR_SET_FROM_SOURCE(3) + + + + + + + + +
ZIP_ERROR_SET_FROM_SOURCE(3)Library Functions ManualZIP_ERROR_SET_FROM_SOURCE(3)
+
+
+

+zip_error_set_from_source — +
fill in zip_error structure from source
+
+
+

+libzip (-lzip) +
+
+

+#include <zip.h> +

void +
+ zip_error_set_from_source(zip_error_t + *ze, zip_source_t + *src);

+
+
+

+The zip_error_set_from_source() function sets the + zip_error pointed to by ze to the error reported by + src as returned by + zip_error_source(3). + ze must be allocated and initialized with + zip_error_init(3) before calling + zip_error_set_from_source(). +
+
+

+libzip(3), + zip_error_init(3), + zip_error_set(3) +
+
+

+zip_error_set_from_source() was added in libzip 1.10. +
+
+

+Dieter Baron + <dillo@nih.at> and + Thomas Klausner + <wiz@gatalith.at> +
+
+ + + + + +
December 5, 2022NiH
+ + diff --git a/release/src-rt-6.x.4708/router/libzip/man/zip_error_set_from_source.man b/release/src-rt-6.x.4708/router/libzip/man/zip_error_set_from_source.man new file mode 100644 index 0000000000..148236c2f2 --- /dev/null +++ b/release/src-rt-6.x.4708/router/libzip/man/zip_error_set_from_source.man @@ -0,0 +1,74 @@ +.\" Automatically generated from an mdoc input file. Do not edit. +.\" zip_error_set_from_source.mdoc -- set zip_error from source +.\" Copyright (C) 2022 Dieter Baron and Thomas Klausner +.\" +.\" This file is part of libzip, a library to manipulate ZIP archives. +.\" The authors can be contacted at +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" 3. The names of the authors may not be used to endorse or promote +.\" products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS +.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.TH "ZIP_ERROR_SET_FROM_SOURCE" "3" "December 5, 2022" "NiH" "Library Functions Manual" +.nh +.if n .ad l +.SH "NAME" +\fBzip_error_set_from_source\fR +\- fill in zip_error structure from source +.SH "LIBRARY" +libzip (-lzip) +.SH "SYNOPSIS" +\fB#include \fR +.sp +\fIvoid\fR +.br +.PD 0 +.HP 4n +\fBzip_error_set_from_source\fR(\fIzip_error_t\ *ze\fR, \fIzip_source_t\ *src\fR); +.PD +.SH "DESCRIPTION" +The +\fBzip_error_set_from_source\fR() +function sets the zip_error pointed to by +\fIze\fR +to the error reported by +\fIsrc\fR +as returned by +zip_error_source(3). +\fIze\fR +must be allocated and initialized with +zip_error_init(3) +before calling +\fBzip_error_set_from_source\fR(). +.SH "SEE ALSO" +libzip(3), +zip_error_init(3), +zip_error_set(3) +.SH "HISTORY" +\fBzip_error_set_from_source\fR() +was added in libzip 1.10. +.SH "AUTHORS" +Dieter Baron <\fIdillo@nih.at\fR> +and +Thomas Klausner <\fIwiz@gatalith.at\fR> diff --git a/release/src-rt-6.x.4708/router/libzip/man/zip_source_file.html b/release/src-rt-6.x.4708/router/libzip/man/zip_source_file.html index 7344fa7bb3..00ba762489 100644 --- a/release/src-rt-6.x.4708/router/libzip/man/zip_source_file.html +++ b/release/src-rt-6.x.4708/router/libzip/man/zip_source_file.html @@ -94,7 +94,7 @@ The functions zip_source_file() and zip_close(3)).

libzip can do various optimizations if the size of a source is known when it's created, so - ZIP_LENGTH_TO_END is preferrable. If you deal with + ZIP_LENGTH_TO_END is preferable. If you deal with files that are likely to change while you are processing them, you can use the less efficient ZIP_LENGTH_UNCHECKED.

If the file supports seek, the source can be used to open a zip diff --git a/release/src-rt-6.x.4708/router/libzip/man/zip_source_file.man b/release/src-rt-6.x.4708/router/libzip/man/zip_source_file.man index c74837eb60..586fb07610 100644 --- a/release/src-rt-6.x.4708/router/libzip/man/zip_source_file.man +++ b/release/src-rt-6.x.4708/router/libzip/man/zip_source_file.man @@ -97,7 +97,7 @@ zip_close(3)). can do various optimizations if the size of a source is known when it's created, so \fRZIP_LENGTH_TO_END\fR -is preferrable. +is preferable. If you deal with files that are likely to change while you are processing them, you can use the less efficient \fRZIP_LENGTH_UNCHECKED\fR. diff --git a/release/src-rt-6.x.4708/router/libzip/man/zip_source_file.mdoc b/release/src-rt-6.x.4708/router/libzip/man/zip_source_file.mdoc index 1e37faca53..15b7c0002e 100644 --- a/release/src-rt-6.x.4708/router/libzip/man/zip_source_file.mdoc +++ b/release/src-rt-6.x.4708/router/libzip/man/zip_source_file.mdoc @@ -86,7 +86,7 @@ Reading from the source returns as much data as is there at that time can do various optimizations if the size of a source is known when it's created, so .Dv ZIP_LENGTH_TO_END -is preferrable. +is preferable. If you deal with files that are likely to change while you are processing them, you can use the less efficient .Dv ZIP_LENGTH_UNCHECKED . diff --git a/release/src-rt-6.x.4708/router/libzip/regress/hmac-error.test b/release/src-rt-6.x.4708/router/libzip/regress/hmac-error.test new file mode 100644 index 0000000000..66644ce49f --- /dev/null +++ b/release/src-rt-6.x.4708/router/libzip/regress/hmac-error.test @@ -0,0 +1,10 @@ +description test file that has an HMAC error +return 1 +arguments hmac-error.zip set_password 1234 cat 0 +file hmac-error.zip hmac-error.zip +stdout +The quick brown fox jumps over t quazy dog +end-of-inline-data +stderr +can't read file at index '0': CRC error +end-of-inline-data diff --git a/release/src-rt-6.x.4708/router/libzip/regress/hmac-error.zip b/release/src-rt-6.x.4708/router/libzip/regress/hmac-error.zip new file mode 100644 index 0000000000..c8be5908e5 Binary files /dev/null and b/release/src-rt-6.x.4708/router/libzip/regress/hmac-error.zip differ diff --git a/release/src-rt-6.x.4708/router/libzip/regress/incons-trailing-garbage.zip b/release/src-rt-6.x.4708/router/libzip/regress/incons-trailing-garbage.zip new file mode 100644 index 0000000000..2f090353ef Binary files /dev/null and b/release/src-rt-6.x.4708/router/libzip/regress/incons-trailing-garbage.zip differ diff --git a/release/src-rt-6.x.4708/router/libzip/regress/read_incons.test b/release/src-rt-6.x.4708/router/libzip/regress/read_incons.test new file mode 100644 index 0000000000..cab43f52b5 --- /dev/null +++ b/release/src-rt-6.x.4708/router/libzip/regress/read_incons.test @@ -0,0 +1,9 @@ +arguments -c test.zip cat 0 +return 1 +file test.zip incons-trailing-garbage.zip +stdout +test +end-of-inline-data +stderr +can't read file at index '0': Zip archive inconsistent: garbage at end of compressed data +end-of-inline-data diff --git a/release/src-rt-6.x.4708/router/libzip/zipconf.h.in b/release/src-rt-6.x.4708/router/libzip/zipconf.h.in index b88ed267fa..04dce7184a 100644 --- a/release/src-rt-6.x.4708/router/libzip/zipconf.h.in +++ b/release/src-rt-6.x.4708/router/libzip/zipconf.h.in @@ -15,8 +15,6 @@ #cmakedefine ZIP_STATIC -${ZIP_NULLABLE_DEFINES} - ${LIBZIP_TYPES_INCLUDE} typedef ${ZIP_INT8_T} zip_int8_t; diff --git a/release/src-rt-6.x.4708/router/patches/libzip/101-fix-build-break--mips.patch b/release/src-rt-6.x.4708/router/patches/libzip/101-fix-build-break--mips.patch index 90ebdd9a21..e4b9bd202a 100644 --- a/release/src-rt-6.x.4708/router/patches/libzip/101-fix-build-break--mips.patch +++ b/release/src-rt-6.x.4708/router/patches/libzip/101-fix-build-break--mips.patch @@ -1,6 +1,6 @@ --- libzip/lib/zip.h +++ libzip/lib/zip.h -@@ -59,8 +59,10 @@ +@@ -68,8 +68,10 @@ #endif #ifndef ZIP_DEPRECATED