mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-11-25 06:47:48 -05:00
* Update the Vendored miniz to 3.1.2 The 2.1.0 copy reads every .3mf and plugin archive we open. Upstream has since fixed a central-directory offset overflow when reading the zip header, an infinite loop in tinfl_decompress on a zero code length, an integer overflow in the header corruption check, wrong sizes in mz_zip_reader_extract_to_heap and several uninitialised reads on malformed deflate streams, none of which 2.1.0 has. The local modifications are carried over onto the new amalgamation: m_is_utf8 on mz_zip_archive_file_stat, mz_zip_reader_get_extra and mz_zip_reader_get_filename_from_extra, mz_zip_reader_extract_to_file_w and mz_zip_writer_add_file_ex for Windows paths, the PrusaSlicer staged writer (mz_zip_writer_add_staged_open/data/finish) and the zip64 "version needed" fields. The max_size form of mz_zip_writer_add_read_buf_callback that PrusaSlicer had patched in is upstream since 2.2.0 and is taken from there. Verified on Linux: the application and tests build, and the [3mf], [AMF], [plugin], [project], [SL1Import] and [TextureImport] libslic3r tests pass (88 cases, 1908 assertions). * Pass UTF-8 Paths to miniz on Windows miniz 3.x converts narrow file names from UTF-8 to wide characters before opening them, where the vendored 2.1.0 passed them to fopen as local code page bytes. The call sites that wrapped their paths in encode_path() therefore handed it code page bytes to decode as UTF-8, which breaks any non-ASCII path. Pass the UTF-8 strings straight through; the zip entry names still use the native encoding plus the Unicode path extra field. * Record the Local miniz Changes as a Patch The vendored miniz carries BBS and PrusaResearch changes that README-Prusa described only in prose, so each upstream bump meant finding them again by hand. Commit the diff between the upstream 3.1.2 release and the files here, and have the README list what it carries and how to re-apply it. * Extract Plug-in Files Through extract_zip_entry_to_file install_plugin still handed miniz a destination converted to the local code page, which 3.x decodes as UTF-8, so a non-ASCII install path was mangled; the open then failed and fell back to mz_zip_reader_extract_to_file_w. That carried function never worked: mz_wfopen passed a narrow mode string to _wfopen_s, the stream was opened in text mode, and the wide path went into the narrow mz_zip_set_file_times. Use the existing helper, which opens an extended-length wide path in binary mode, and drop the _w API from miniz, the patch and the README.