react-native-nitro-xlsx 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NitroXlsx.podspec +26 -27
- package/Package.swift +31 -10
- package/README.md +21 -9
- package/android/CMakeLists.txt +20 -27
- package/cpp/HybridNitroXlsx.cpp +25 -1
- package/cpp/HybridXlsxCellFormat.cpp +46 -146
- package/cpp/HybridXlsxCellFormat.hpp +9 -41
- package/cpp/HybridXlsxConditionalFormat.cpp +4 -1
- package/cpp/HybridXlsxConditionalFormats.cpp +5 -1
- package/cpp/HybridXlsxWorkbook.cpp +38 -8
- package/cpp/HybridXlsxWorkbook.hpp +10 -1
- package/cpp/HybridXlsxWorksheet.cpp +422 -141
- package/cpp/HybridXlsxWorksheet.hpp +4 -1
- package/cpp/XlsxCacheDir.cpp +25 -2
- package/cpp/XlsxCacheDir.hpp +3 -1
- package/cpp/XlsxCellStyle.hpp +360 -0
- package/cpp/XlsxJson.cpp +29 -8
- package/package.json +2 -2
- package/scripts/run-cpp-tests.sh +1 -1
- package/scripts/sync-openxlsx-headers.sh +34 -0
- package/src/__mocks__/react-native-nitro-modules.ts +523 -20
- package/src/__tests__/index.test.ts +124 -16
- package/src/index.ts +13 -13
- package/thirdparty/OpenXLSX/.clang-format +118 -0
- package/thirdparty/OpenXLSX/.clang-tidy +28 -0
- package/thirdparty/OpenXLSX/.gitignore +130 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_before_XMLNode_wrappers +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_and_stripping +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_char_support +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_support +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespaced_name_disabled +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-08-11-benchmarks_post-XLCellIterator-Rework +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-08-14-benchmarks_post-default-row-column-style-support +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-09-02-benchmarks +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-12-19-benchmarks +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-12-30-benchmarks-post-XLSharedStrings-by-ref +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-09-benchmarks-post-conditionalFormatsAndSheetProtection +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-10-benchmarks-post-XLCellValue-bugfix +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-31-benchmarks-post-XLComments-implementation +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-02-02-benchmarks-post-XLRowIterator-Rework +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-07-20-benchmarks-after-hiding-pugixml-internals +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-08-29-benchmarks-after-code-review-with-libzip +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/Benchmark.cpp +249 -0
- package/thirdparty/OpenXLSX/Benchmarks/CMakeLists.txt +19 -0
- package/thirdparty/OpenXLSX/CMakeLists.txt +466 -0
- package/thirdparty/OpenXLSX/Documentation/CMakeLists.txt +31 -0
- package/thirdparty/OpenXLSX/Documentation/Doxyfile.in +2471 -0
- package/thirdparty/OpenXLSX/Documentation/DoxygenLayout.xml +194 -0
- package/thirdparty/OpenXLSX/Documentation/customdoxygen.css +1355 -0
- package/thirdparty/OpenXLSX/Examples/CMakeLists.txt +103 -0
- package/thirdparty/OpenXLSX/Examples/Demo1.cpp +279 -0
- package/thirdparty/OpenXLSX/Examples/Demo10.cpp +545 -0
- package/thirdparty/OpenXLSX/Examples/Demo1A.cpp +137 -0
- package/thirdparty/OpenXLSX/Examples/Demo2.cpp +65 -0
- package/thirdparty/OpenXLSX/Examples/Demo3.cpp +89 -0
- package/thirdparty/OpenXLSX/Examples/Demo4.cpp +86 -0
- package/thirdparty/OpenXLSX/Examples/Demo5.cpp +77 -0
- package/thirdparty/OpenXLSX/Examples/Demo6.cpp +103 -0
- package/thirdparty/OpenXLSX/Examples/Demo7.cpp +79 -0
- package/thirdparty/OpenXLSX/Examples/Demo8.cpp +117 -0
- package/thirdparty/OpenXLSX/Examples/Demo9.cpp +363 -0
- package/thirdparty/OpenXLSX/Examples/cmake/FindLIBZIP.cmake +61 -0
- package/thirdparty/OpenXLSX/Examples/external/CustomZip/CustomZip.hpp +256 -0
- package/thirdparty/OpenXLSX/LICENSE.md +29 -0
- package/thirdparty/OpenXLSX/Makefile.GNU +530 -0
- package/thirdparty/OpenXLSX/Notes/TBDs.txt +16 -0
- package/thirdparty/OpenXLSX/Notes/confirmed-TBCs.txt +8 -0
- package/thirdparty/OpenXLSX/Notes/styles-missing-support.xml +12 -0
- package/thirdparty/OpenXLSX/Notes/todo-list.txt +108 -0
- package/thirdparty/OpenXLSX/OpenXLSX/CMakeLists.txt +631 -0
- package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSX.hpp +63 -0
- package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSXConfig.cmake +11 -0
- package/thirdparty/OpenXLSX/OpenXLSX/cmake/bundle_static_library.cmake +198 -0
- package/thirdparty/OpenXLSX/OpenXLSX/cmake/patch_pkg_config.cmake +69 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/IZipArchive.hpp +361 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/IZipArchive.hpp +361 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/OpenXLSX-Exports.hpp +12 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCell.hpp +367 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellIterator.hpp +252 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellRange.hpp +223 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellReference.hpp +317 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCellValue.hpp +793 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLColor.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLColumn.hpp +159 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLCommandQuery.hpp +228 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLComments.hpp +270 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLConstants.hpp +18 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLContentTypes.hpp +264 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLDateTime.hpp +175 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLDocument.hpp +505 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLDrawing.hpp +452 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLException.hpp +161 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLFormula.hpp +375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLIterator.hpp +40 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLMergeCells.hpp +216 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLProperties.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLRelationships.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLRow.hpp +721 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLRowData.hpp +488 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLSharedStrings.hpp +204 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLSheet.hpp +1640 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLStyles.hpp +2390 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLTables.hpp +132 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLWorkbook.hpp +404 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlData.hpp +283 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlFile.hpp +194 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlParser.hpp +282 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLXmlParserForwardDeclarations.hpp +85 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/XLZipArchive.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/detail/LibZip.hpp +447 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/detail/OpenXLSXFileSystemTools.hpp +207 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX/detail/Zippy.hpp +1375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX-Exports.hpp +12 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCell.hpp +367 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellIterator.hpp +252 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellRange.hpp +223 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellReference.hpp +317 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellValue.hpp +793 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColor.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColumn.hpp +159 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCommandQuery.hpp +228 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLComments.hpp +270 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLConstants.hpp +18 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLContentTypes.hpp +264 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDateTime.hpp +175 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDocument.hpp +505 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDrawing.hpp +452 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLException.hpp +161 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLFormula.hpp +375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLIterator.hpp +40 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLMergeCells.hpp +216 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLProperties.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRelationships.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRow.hpp +721 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRowData.hpp +488 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSharedStrings.hpp +204 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSheet.hpp +1640 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLStyles.hpp +2390 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLTables.hpp +132 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLWorkbook.hpp +404 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlData.hpp +283 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlFile.hpp +194 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParser.hpp +282 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParserForwardDeclarations.hpp +85 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLZipArchive.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/LibZip.hpp +447 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/OpenXLSXFileSystemTools.hpp +207 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/Zippy.hpp +1375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCell.cpp +340 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellIterator.cpp +427 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellRange.cpp +221 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellReference.cpp +408 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellValue.cpp +519 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColor.cpp +202 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColumn.cpp +141 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLComments.cpp +637 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLContentTypes.cpp +329 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDateTime.cpp +269 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDocument.cpp +1678 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDrawing.cpp +784 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLFormula.cpp +201 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLMergeCells.cpp +357 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLProperties.cpp +810 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRelationships.cpp +529 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRow.cpp +918 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRowData.cpp +508 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSharedStrings.cpp +220 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSheet.cpp +1970 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLStyles.cpp +3014 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLTables.cpp +125 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLWorkbook.cpp +784 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlData.cpp +247 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlFile.cpp +160 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlParser.cpp +261 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLZipArchive.cpp +266 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/utilities/XLUtilities.hpp +478 -0
- package/thirdparty/OpenXLSX/README.md +1279 -0
- package/thirdparty/OpenXLSX/Scripts/cmake-cleanup.sh +102 -0
- package/thirdparty/OpenXLSX/Scripts/compile.sh +23 -0
- package/thirdparty/OpenXLSX/Scripts/demos-cleanup.sh +25 -0
- package/thirdparty/OpenXLSX/Scripts/demos-run-all.sh +60 -0
- package/thirdparty/OpenXLSX/Scripts/guarded-xml-format.sh +47 -0
- package/thirdparty/OpenXLSX/Scripts/make-gnu.sh +11 -0
- package/thirdparty/OpenXLSX/Scripts/uninstall-manifest.sh +48 -0
- package/thirdparty/OpenXLSX/Scripts/xml-format-all.sh +19 -0
- package/thirdparty/OpenXLSX/Scripts/xml-format.sh +38 -0
- package/thirdparty/OpenXLSX/Tests/CMakeLists.txt +37 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch.hpp +17799 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_automake.hpp +68 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_sonarqube.hpp +182 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_tap.hpp +278 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_teamcity.hpp +212 -0
- package/thirdparty/OpenXLSX/Tests/main.cpp +55 -0
- package/thirdparty/OpenXLSX/Tests/testXLCell.cpp +176 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellRange.cpp +180 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellReference.cpp +160 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellValue.cpp +366 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellValueProxy.cpp +255 -0
- package/thirdparty/OpenXLSX/Tests/testXLColor.cpp +75 -0
- package/thirdparty/OpenXLSX/Tests/testXLDateTime.cpp +229 -0
- package/thirdparty/OpenXLSX/Tests/testXLDocument.cpp +197 -0
- package/thirdparty/OpenXLSX/Tests/testXLFormula.cpp +131 -0
- package/thirdparty/OpenXLSX/Tests/testXLRow.cpp +597 -0
- package/thirdparty/OpenXLSX/Tests/testXLSheet.cpp +77 -0
- package/thirdparty/OpenXLSX/Tests/ziptest-with-libs.cpp +88 -0
- package/thirdparty/OpenXLSX/Tests/ziptest.cpp +735 -0
- package/thirdparty/OpenXLSX/cmake/get-git-HEAD-ID.cmake +45 -0
- package/thirdparty/OpenXLSX/cmake/libopenxlsxCPackOptions.cmake.in +20 -0
- package/thirdparty/OpenXLSX/cmake/manage_dependency.cmake +813 -0
- package/thirdparty/OpenXLSX/cmake/recursive_library_type_test.cmake +52 -0
- package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-shared.hpp +42 -0
- package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-static.hpp +42 -0
- package/thirdparty/OpenXLSX/vcpkg.json +24 -0
- package/thirdparty/README.md +46 -0
- package/thirdparty/miniz/.clang-format +47 -0
- package/thirdparty/miniz/.travis.yml +2 -0
- package/thirdparty/miniz/CMakeLists.txt +333 -0
- package/thirdparty/miniz/CMakePresets.json +31 -0
- package/thirdparty/miniz/ChangeLog.md +272 -0
- package/thirdparty/miniz/Config.cmake.in +1 -0
- package/thirdparty/miniz/LICENSE +22 -0
- package/thirdparty/miniz/amalgamate.sh +57 -0
- package/thirdparty/miniz/examples/example1.c +105 -0
- package/thirdparty/miniz/examples/example2.c +164 -0
- package/thirdparty/miniz/examples/example3.c +269 -0
- package/thirdparty/miniz/examples/example4.c +102 -0
- package/thirdparty/miniz/examples/example5.c +327 -0
- package/thirdparty/miniz/examples/example6.c +189 -0
- package/thirdparty/miniz/meson.build +21 -0
- package/thirdparty/miniz/miniz.c +646 -0
- package/thirdparty/miniz/miniz.h +615 -0
- package/thirdparty/miniz/miniz.pc.in +13 -0
- package/thirdparty/miniz/miniz_common.h +89 -0
- package/thirdparty/miniz/miniz_export.h +20 -0
- package/thirdparty/miniz/miniz_tdef.c +1602 -0
- package/thirdparty/miniz/miniz_tdef.h +199 -0
- package/thirdparty/miniz/miniz_tinfl.c +778 -0
- package/thirdparty/miniz/miniz_tinfl.h +150 -0
- package/thirdparty/miniz/miniz_zip.c +4895 -0
- package/thirdparty/miniz/miniz_zip.h +454 -0
- package/thirdparty/miniz/readme.md +46 -0
- package/thirdparty/miniz/test.sh +36 -0
- package/thirdparty/miniz/tests/add_in_place_fuzzer.c +87 -0
- package/thirdparty/miniz/tests/catch_amalgamated.cpp +10795 -0
- package/thirdparty/miniz/tests/catch_amalgamated.hpp +13143 -0
- package/thirdparty/miniz/tests/checksum_fuzzer.c +26 -0
- package/thirdparty/miniz/tests/compress_fuzzer.c +91 -0
- package/thirdparty/miniz/tests/flush_fuzzer.c +88 -0
- package/thirdparty/miniz/tests/fuzz_main.c +55 -0
- package/thirdparty/miniz/tests/large_fuzzer.c +133 -0
- package/thirdparty/miniz/tests/main.cpp +185 -0
- package/thirdparty/miniz/tests/miniz_tdefl_fuzzer.cc +115 -0
- package/thirdparty/miniz/tests/miniz_tester.cpp +1881 -0
- package/thirdparty/miniz/tests/miniz_zip_validate_fuzzer.cc +71 -0
- package/thirdparty/miniz/tests/miniz_zip_writer_fuzzer.cc +96 -0
- package/thirdparty/miniz/tests/ossfuzz.sh +48 -0
- package/thirdparty/miniz/tests/small_fuzzer.c +126 -0
- package/thirdparty/miniz/tests/timer.cpp +152 -0
- package/thirdparty/miniz/tests/timer.h +40 -0
- package/thirdparty/miniz/tests/uncompress2_fuzzer.c +21 -0
- package/thirdparty/miniz/tests/uncompress_fuzzer.c +30 -0
- package/thirdparty/miniz/tests/zip.dict +9 -0
- package/thirdparty/miniz/tests/zip_fuzzer.c +63 -0
- package/thirdparty/pugixml/.codecov.yml +7 -0
- package/thirdparty/pugixml/.gitattributes +1 -0
- package/thirdparty/pugixml/CMakeLists.txt +330 -0
- package/thirdparty/pugixml/LICENSE.md +24 -0
- package/thirdparty/pugixml/Makefile +98 -0
- package/thirdparty/pugixml/README.md +81 -0
- package/thirdparty/pugixml/SECURITY.md +9 -0
- package/thirdparty/pugixml/appveyor.yml +50 -0
- package/thirdparty/pugixml/docs/config.adoc +7 -0
- package/thirdparty/pugixml/docs/images/dom_tree.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_link1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_link2.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch2.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch3.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch4.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2010_link1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2010_link2.png +0 -0
- package/thirdparty/pugixml/docs/manual.adoc +3326 -0
- package/thirdparty/pugixml/docs/manual.html +6395 -0
- package/thirdparty/pugixml/docs/quickstart.adoc +287 -0
- package/thirdparty/pugixml/docs/quickstart.html +1107 -0
- package/thirdparty/pugixml/docs/samples/character.xml +8 -0
- package/thirdparty/pugixml/docs/samples/custom_memory_management.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/include.cpp +64 -0
- package/thirdparty/pugixml/docs/samples/load_error_handling.cpp +33 -0
- package/thirdparty/pugixml/docs/samples/load_file.cpp +16 -0
- package/thirdparty/pugixml/docs/samples/load_memory.cpp +66 -0
- package/thirdparty/pugixml/docs/samples/load_options.cpp +30 -0
- package/thirdparty/pugixml/docs/samples/load_stream.cpp +97 -0
- package/thirdparty/pugixml/docs/samples/modify_add.cpp +29 -0
- package/thirdparty/pugixml/docs/samples/modify_base.cpp +43 -0
- package/thirdparty/pugixml/docs/samples/modify_remove.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/save_custom_writer.cpp +116 -0
- package/thirdparty/pugixml/docs/samples/save_declaration.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/save_file.cpp +17 -0
- package/thirdparty/pugixml/docs/samples/save_options.cpp +48 -0
- package/thirdparty/pugixml/docs/samples/save_stream.cpp +18 -0
- package/thirdparty/pugixml/docs/samples/save_subtree.cpp +26 -0
- package/thirdparty/pugixml/docs/samples/text.cpp +35 -0
- package/thirdparty/pugixml/docs/samples/transitions.xml +7 -0
- package/thirdparty/pugixml/docs/samples/traverse_base.cpp +51 -0
- package/thirdparty/pugixml/docs/samples/traverse_iter.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/traverse_predicate.cpp +48 -0
- package/thirdparty/pugixml/docs/samples/traverse_rangefor.cpp +32 -0
- package/thirdparty/pugixml/docs/samples/traverse_walker.cpp +35 -0
- package/thirdparty/pugixml/docs/samples/tree.xml +12 -0
- package/thirdparty/pugixml/docs/samples/weekly-shift_jis.xml +78 -0
- package/thirdparty/pugixml/docs/samples/weekly-utf-16.xml +0 -0
- package/thirdparty/pugixml/docs/samples/weekly-utf-8.xml +78 -0
- package/thirdparty/pugixml/docs/samples/xgconsole.xml +12 -0
- package/thirdparty/pugixml/docs/samples/xpath_error.cpp +43 -0
- package/thirdparty/pugixml/docs/samples/xpath_query.cpp +36 -0
- package/thirdparty/pugixml/docs/samples/xpath_select.cpp +28 -0
- package/thirdparty/pugixml/docs/samples/xpath_variables.cpp +38 -0
- package/thirdparty/pugixml/readme.txt +50 -0
- package/thirdparty/pugixml/scripts/archive.py +54 -0
- package/thirdparty/pugixml/scripts/cocoapods_push.sh +4 -0
- package/thirdparty/pugixml/scripts/natvis/pugixml.natvis +77 -0
- package/thirdparty/pugixml/scripts/natvis/pugixml_compact.natvis +506 -0
- package/thirdparty/pugixml/scripts/nuget/build/native/pugixml-propertiesui.xml +17 -0
- package/thirdparty/pugixml/scripts/nuget/build/native/pugixml.targets +28 -0
- package/thirdparty/pugixml/scripts/nuget/pugixml.nuspec +20 -0
- package/thirdparty/pugixml/scripts/nuget_build.ps1 +60 -0
- package/thirdparty/pugixml/scripts/premake4.lua +92 -0
- package/thirdparty/pugixml/scripts/pugixml-config.cmake.in +12 -0
- package/thirdparty/pugixml/scripts/pugixml.pc.in +11 -0
- package/thirdparty/pugixml/scripts/pugixml.podspec +14 -0
- package/thirdparty/pugixml/scripts/pugixml.xcodeproj/project.pbxproj +212 -0
- package/thirdparty/pugixml/scripts/pugixml_airplay.mkf +13 -0
- package/thirdparty/pugixml/scripts/pugixml_codeblocks.cbp +44 -0
- package/thirdparty/pugixml/scripts/pugixml_codelite.project +56 -0
- package/thirdparty/pugixml/scripts/pugixml_dll.rc +45 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2005.vcproj +343 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2005_static.vcproj +343 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2008.vcproj +339 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2008_static.vcproj +339 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2010.vcxproj +191 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2010_static.vcxproj +191 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2013.vcxproj +199 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2013_static.vcxproj +199 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2015.vcxproj +172 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2015_static.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2017.vcxproj +172 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2017_static.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2019.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2019_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2022.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2022_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2026.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2026_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/sbom.cdx.json +47 -0
- package/thirdparty/pugixml/src/pugiconfig.hpp +81 -0
- package/thirdparty/pugixml/src/pugixml.cpp +13776 -0
- package/thirdparty/pugixml/src/pugixml.hpp +1604 -0
- package/thirdparty/pugixml/tests/allocator.cpp +175 -0
- package/thirdparty/pugixml/tests/allocator.hpp +10 -0
- package/thirdparty/pugixml/tests/autotest-appveyor.ps1 +93 -0
- package/thirdparty/pugixml/tests/cmake-appveyor.ps1 +57 -0
- package/thirdparty/pugixml/tests/data/empty.xml +0 -0
- package/thirdparty/pugixml/tests/data/large.xml +1 -0
- package/thirdparty/pugixml/tests/data/latintest_latin1.xml +1 -0
- package/thirdparty/pugixml/tests/data/latintest_utf8.xml +1 -0
- package/thirdparty/pugixml/tests/data/multiline.xml +3 -0
- package/thirdparty/pugixml/tests/data/small.xml +1 -0
- package/thirdparty/pugixml/tests/data/truncation.xml +19 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8.xml +87 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_bom.xml +87 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_clean.xml +84 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_nodecl.xml +86 -0
- package/thirdparty/pugixml/tests/data//321/202/320/265/321/201/321/202.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/basic.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/doctype.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/refs.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/types.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/utf16.xml +0 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/utf32.xml +0 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/basic.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/functions.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/math.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/path.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/predicate.xpath +1 -0
- package/thirdparty/pugixml/tests/fuzz_parse.cpp +14 -0
- package/thirdparty/pugixml/tests/fuzz_parse.dict +72 -0
- package/thirdparty/pugixml/tests/fuzz_setup.sh +11 -0
- package/thirdparty/pugixml/tests/fuzz_xpath.cpp +46 -0
- package/thirdparty/pugixml/tests/fuzz_xpath.dict +72 -0
- package/thirdparty/pugixml/tests/helpers.hpp +114 -0
- package/thirdparty/pugixml/tests/main.cpp +218 -0
- package/thirdparty/pugixml/tests/test.cpp +220 -0
- package/thirdparty/pugixml/tests/test.hpp +175 -0
- package/thirdparty/pugixml/tests/test_compact.cpp +150 -0
- package/thirdparty/pugixml/tests/test_deprecated.cpp +25 -0
- package/thirdparty/pugixml/tests/test_document.cpp +1910 -0
- package/thirdparty/pugixml/tests/test_dom_modify.cpp +2122 -0
- package/thirdparty/pugixml/tests/test_dom_text.cpp +601 -0
- package/thirdparty/pugixml/tests/test_dom_traverse.cpp +1481 -0
- package/thirdparty/pugixml/tests/test_header_guard.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iosfwd_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iosfwd_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iostream_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iostream_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_only_1.cpp +21 -0
- package/thirdparty/pugixml/tests/test_header_only_2.cpp +21 -0
- package/thirdparty/pugixml/tests/test_header_string_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_string_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_string_iostream.cpp +5 -0
- package/thirdparty/pugixml/tests/test_memory.cpp +303 -0
- package/thirdparty/pugixml/tests/test_parse.cpp +1463 -0
- package/thirdparty/pugixml/tests/test_parse_doctype.cpp +366 -0
- package/thirdparty/pugixml/tests/test_unicode.cpp +152 -0
- package/thirdparty/pugixml/tests/test_version.cpp +5 -0
- package/thirdparty/pugixml/tests/test_write.cpp +757 -0
- package/thirdparty/pugixml/tests/test_xpath.cpp +833 -0
- package/thirdparty/pugixml/tests/test_xpath_api.cpp +646 -0
- package/thirdparty/pugixml/tests/test_xpath_functions.cpp +844 -0
- package/thirdparty/pugixml/tests/test_xpath_operators.cpp +566 -0
- package/thirdparty/pugixml/tests/test_xpath_parse.cpp +428 -0
- package/thirdparty/pugixml/tests/test_xpath_paths.cpp +787 -0
- package/thirdparty/pugixml/tests/test_xpath_paths_abbrev_w3c.cpp +219 -0
- package/thirdparty/pugixml/tests/test_xpath_paths_w3c.cpp +312 -0
- package/thirdparty/pugixml/tests/test_xpath_variables.cpp +683 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_1.cpp +411 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_2.cpp +417 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_3.cpp +321 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_4.cpp +300 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_5.cpp +295 -0
- package/thirdparty/pugixml/tests/writer_string.cpp +79 -0
- package/thirdparty/pugixml/tests/writer_string.hpp +27 -0
- package/scripts/prepare-openxlsx.js +0 -126
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* Derived from zlib fuzzers at http://github.com/google/oss-fuzz/tree/master/projects/zlib,
|
|
2
|
+
* see ossfuzz.sh for full license text.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#include <stddef.h>
|
|
6
|
+
#include <stdint.h>
|
|
7
|
+
#include <inttypes.h>
|
|
8
|
+
|
|
9
|
+
#include "miniz.h"
|
|
10
|
+
|
|
11
|
+
static const size_t kMaxSize = 1024 * 1024;
|
|
12
|
+
|
|
13
|
+
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t dataLen)
|
|
14
|
+
{
|
|
15
|
+
/* Discard inputs larger than 1Mb. */
|
|
16
|
+
if (dataLen < 1 || dataLen > kMaxSize)
|
|
17
|
+
return 0;
|
|
18
|
+
|
|
19
|
+
uint32_t crc = crc32(0L, NULL, 0);
|
|
20
|
+
uint32_t adler = adler32(0L, NULL, 0);
|
|
21
|
+
|
|
22
|
+
crc = crc32(crc, data, (uint32_t)dataLen);
|
|
23
|
+
adler = adler32(adler, data, (uint32_t)dataLen);
|
|
24
|
+
|
|
25
|
+
return 0;
|
|
26
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/* Derived from zlib fuzzers at http://github.com/google/oss-fuzz/tree/master/projects/zlib,
|
|
2
|
+
* see ossfuzz.sh for full license text.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#include <stdio.h>
|
|
6
|
+
#include <stddef.h>
|
|
7
|
+
#include <stdint.h>
|
|
8
|
+
#include <string.h>
|
|
9
|
+
#include <assert.h>
|
|
10
|
+
#include <stdlib.h>
|
|
11
|
+
#include <inttypes.h>
|
|
12
|
+
#include "miniz.h"
|
|
13
|
+
|
|
14
|
+
static const uint8_t *data;
|
|
15
|
+
static size_t dataLen;
|
|
16
|
+
|
|
17
|
+
static void check_compress_level(uint8_t *compr, size_t comprLen,
|
|
18
|
+
uint8_t *uncompr, size_t uncomprLen,
|
|
19
|
+
int level)
|
|
20
|
+
{
|
|
21
|
+
compress2(compr, &comprLen, data, dataLen, level);
|
|
22
|
+
uncompress(uncompr, &uncomprLen, compr, comprLen);
|
|
23
|
+
|
|
24
|
+
/* Make sure compress + uncompress gives back the input data. */
|
|
25
|
+
assert(dataLen == uncomprLen);
|
|
26
|
+
assert(0 == memcmp(data, uncompr, dataLen));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#define put_byte(s, i, c) \
|
|
30
|
+
{ \
|
|
31
|
+
s[i] = (unsigned char)(c); \
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static void write_zlib_header(uint8_t *s)
|
|
35
|
+
{
|
|
36
|
+
unsigned level_flags = 0; /* compression level (0..3) */
|
|
37
|
+
unsigned w_bits = 8; /* window size log2(w_size) (8..16) */
|
|
38
|
+
unsigned int header = (Z_DEFLATED + ((w_bits - 8) << 4)) << 8;
|
|
39
|
+
header |= (level_flags << 6);
|
|
40
|
+
|
|
41
|
+
header += 31 - (header % 31);
|
|
42
|
+
|
|
43
|
+
/* s is guaranteed to be longer than 2 bytes. */
|
|
44
|
+
put_byte(s, 0, (unsigned char)(header >> 8));
|
|
45
|
+
put_byte(s, 1, (unsigned char)(header & 0xff));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static void check_decompress(uint8_t *compr, size_t comprLen)
|
|
49
|
+
{
|
|
50
|
+
/* We need to write a valid zlib header of size two bytes. Copy the input data
|
|
51
|
+
in a larger buffer. Do not modify the input data to avoid libFuzzer error:
|
|
52
|
+
fuzz target overwrites its const input. */
|
|
53
|
+
size_t copyLen = dataLen + 2;
|
|
54
|
+
uint8_t *copy = malloc(copyLen);
|
|
55
|
+
memcpy(copy + 2, data, dataLen);
|
|
56
|
+
write_zlib_header(copy);
|
|
57
|
+
|
|
58
|
+
uncompress(compr, &comprLen, copy, copyLen);
|
|
59
|
+
free(copy);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size)
|
|
63
|
+
{
|
|
64
|
+
/* compressBound does not provide enough space for low compression levels. */
|
|
65
|
+
size_t comprLen = 100 + 2 * compressBound(size);
|
|
66
|
+
size_t uncomprLen = size;
|
|
67
|
+
uint8_t *compr, *uncompr;
|
|
68
|
+
|
|
69
|
+
/* Discard inputs larger than 1Mb. */
|
|
70
|
+
static size_t kMaxSize = 1024 * 1024;
|
|
71
|
+
|
|
72
|
+
if (size < 1 || size > kMaxSize)
|
|
73
|
+
return 0;
|
|
74
|
+
|
|
75
|
+
data = d;
|
|
76
|
+
dataLen = size;
|
|
77
|
+
compr = calloc(1, comprLen);
|
|
78
|
+
uncompr = calloc(1, uncomprLen);
|
|
79
|
+
|
|
80
|
+
check_compress_level(compr, comprLen, uncompr, uncomprLen, 1);
|
|
81
|
+
check_compress_level(compr, comprLen, uncompr, uncomprLen, 3);
|
|
82
|
+
check_compress_level(compr, comprLen, uncompr, uncomprLen, 6);
|
|
83
|
+
check_compress_level(compr, comprLen, uncompr, uncomprLen, 7);
|
|
84
|
+
|
|
85
|
+
check_decompress(compr, comprLen);
|
|
86
|
+
|
|
87
|
+
free(compr);
|
|
88
|
+
free(uncompr);
|
|
89
|
+
|
|
90
|
+
return 0;
|
|
91
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/* Derived from zlib fuzzers at http://github.com/google/oss-fuzz/tree/master/projects/zlib,
|
|
2
|
+
* see ossfuzz.sh for full license text.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#include <stdio.h>
|
|
6
|
+
#include <stddef.h>
|
|
7
|
+
#include <stdint.h>
|
|
8
|
+
#include <string.h>
|
|
9
|
+
#include <stdlib.h>
|
|
10
|
+
#include <inttypes.h>
|
|
11
|
+
|
|
12
|
+
#include "miniz.h"
|
|
13
|
+
|
|
14
|
+
#define CHECK_ERR(err, msg) \
|
|
15
|
+
{ \
|
|
16
|
+
if (err != Z_OK) \
|
|
17
|
+
{ \
|
|
18
|
+
fprintf(stderr, "%s error: %d\n", msg, err); \
|
|
19
|
+
exit(1); \
|
|
20
|
+
} \
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static const uint8_t *data;
|
|
24
|
+
static size_t dataLen;
|
|
25
|
+
static alloc_func zalloc = NULL;
|
|
26
|
+
static free_func zfree = NULL;
|
|
27
|
+
|
|
28
|
+
void test_flush(unsigned char *compr, size_t *comprLen)
|
|
29
|
+
{
|
|
30
|
+
z_stream c_stream; /* compression stream */
|
|
31
|
+
int err;
|
|
32
|
+
unsigned int len = dataLen;
|
|
33
|
+
|
|
34
|
+
c_stream.zalloc = zalloc;
|
|
35
|
+
c_stream.zfree = zfree;
|
|
36
|
+
c_stream.opaque = NULL;
|
|
37
|
+
|
|
38
|
+
err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION);
|
|
39
|
+
CHECK_ERR(err, "deflateInit");
|
|
40
|
+
|
|
41
|
+
c_stream.next_in = (Bytef *)data;
|
|
42
|
+
c_stream.next_out = compr;
|
|
43
|
+
c_stream.avail_in = 3;
|
|
44
|
+
c_stream.avail_out = (unsigned int)*comprLen;
|
|
45
|
+
err = deflate(&c_stream, Z_FULL_FLUSH);
|
|
46
|
+
CHECK_ERR(err, "deflate flush 1");
|
|
47
|
+
|
|
48
|
+
compr[3]++; /* force an error in first compressed block */
|
|
49
|
+
c_stream.avail_in = len - 3;
|
|
50
|
+
|
|
51
|
+
err = deflate(&c_stream, Z_FINISH);
|
|
52
|
+
|
|
53
|
+
if (err != Z_STREAM_END)
|
|
54
|
+
{
|
|
55
|
+
CHECK_ERR(err, "deflate flush 2");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
err = deflateEnd(&c_stream);
|
|
59
|
+
CHECK_ERR(err, "deflateEnd");
|
|
60
|
+
|
|
61
|
+
*comprLen = (size_t)c_stream.total_out;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size)
|
|
65
|
+
{
|
|
66
|
+
size_t comprLen = 100 + 2 * compressBound(size);
|
|
67
|
+
size_t uncomprLen = size;
|
|
68
|
+
uint8_t *compr, *uncompr;
|
|
69
|
+
|
|
70
|
+
/* Discard inputs larger than 1Mb. */
|
|
71
|
+
static const size_t kMaxSize = 1024 * 1024;
|
|
72
|
+
|
|
73
|
+
/* This test requires at least 3 bytes of input data. */
|
|
74
|
+
if (size <= 3 || size > kMaxSize)
|
|
75
|
+
return 0;
|
|
76
|
+
|
|
77
|
+
data = d;
|
|
78
|
+
dataLen = size;
|
|
79
|
+
compr = calloc(1, comprLen);
|
|
80
|
+
uncompr = calloc(1, uncomprLen);
|
|
81
|
+
|
|
82
|
+
test_flush(compr, &comprLen);
|
|
83
|
+
|
|
84
|
+
free(compr);
|
|
85
|
+
free(uncompr);
|
|
86
|
+
|
|
87
|
+
return 0;
|
|
88
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#include <stdio.h>
|
|
2
|
+
#include <stdint.h>
|
|
3
|
+
#include <stdlib.h>
|
|
4
|
+
|
|
5
|
+
/* Fuzz target entry point for building without libFuzzer */
|
|
6
|
+
|
|
7
|
+
int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size);
|
|
8
|
+
|
|
9
|
+
int main(int argc, char **argv)
|
|
10
|
+
{
|
|
11
|
+
FILE *f;
|
|
12
|
+
char *buf = NULL;
|
|
13
|
+
long siz_buf;
|
|
14
|
+
|
|
15
|
+
if (argc < 2)
|
|
16
|
+
{
|
|
17
|
+
fprintf(stderr, "no input file\n");
|
|
18
|
+
goto err;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
f = fopen(argv[1], "rb");
|
|
22
|
+
if (f == NULL)
|
|
23
|
+
{
|
|
24
|
+
fprintf(stderr, "error opening input file %s\n", argv[1]);
|
|
25
|
+
goto err;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
fseek(f, 0, SEEK_END);
|
|
29
|
+
|
|
30
|
+
siz_buf = ftell(f);
|
|
31
|
+
rewind(f);
|
|
32
|
+
|
|
33
|
+
if (siz_buf < 1)
|
|
34
|
+
goto err;
|
|
35
|
+
|
|
36
|
+
buf = (char *)malloc(siz_buf);
|
|
37
|
+
if (buf == NULL)
|
|
38
|
+
{
|
|
39
|
+
fprintf(stderr, "malloc() failed\n");
|
|
40
|
+
goto err;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (fread(buf, siz_buf, 1, f) != 1)
|
|
44
|
+
{
|
|
45
|
+
fprintf(stderr, "fread() failed\n");
|
|
46
|
+
goto err;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
(void)LLVMFuzzerTestOneInput((uint8_t *)buf, siz_buf);
|
|
50
|
+
|
|
51
|
+
err:
|
|
52
|
+
free(buf);
|
|
53
|
+
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/* Derived from zlib fuzzers at http://github.com/google/oss-fuzz/tree/master/projects/zlib,
|
|
2
|
+
* see ossfuzz.sh for full license text.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#include <stdio.h>
|
|
6
|
+
#include <stddef.h>
|
|
7
|
+
#include <stdint.h>
|
|
8
|
+
#include <string.h>
|
|
9
|
+
#include <stdlib.h>
|
|
10
|
+
#include <inttypes.h>
|
|
11
|
+
|
|
12
|
+
#include "miniz.h"
|
|
13
|
+
|
|
14
|
+
#define CHECK_ERR(err, msg) \
|
|
15
|
+
{ \
|
|
16
|
+
if (err != Z_OK) \
|
|
17
|
+
{ \
|
|
18
|
+
fprintf(stderr, "%s error: %d\n", msg, err); \
|
|
19
|
+
exit(1); \
|
|
20
|
+
} \
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static const uint8_t *data;
|
|
24
|
+
static size_t dataLen;
|
|
25
|
+
static alloc_func zalloc = NULL;
|
|
26
|
+
static free_func zfree = NULL;
|
|
27
|
+
static unsigned int diff;
|
|
28
|
+
|
|
29
|
+
/* Test deflate() with large buffers and dynamic change of compression level */
|
|
30
|
+
void test_large_deflate(unsigned char *compr, size_t comprLen,
|
|
31
|
+
unsigned char *uncompr, size_t uncomprLen)
|
|
32
|
+
{
|
|
33
|
+
z_stream c_stream; /* compression stream */
|
|
34
|
+
int err;
|
|
35
|
+
|
|
36
|
+
c_stream.zalloc = zalloc;
|
|
37
|
+
c_stream.zfree = zfree;
|
|
38
|
+
c_stream.opaque = NULL;
|
|
39
|
+
|
|
40
|
+
err = deflateInit(&c_stream, Z_BEST_COMPRESSION);
|
|
41
|
+
CHECK_ERR(err, "deflateInit");
|
|
42
|
+
|
|
43
|
+
c_stream.next_out = compr;
|
|
44
|
+
c_stream.avail_out = (unsigned int)comprLen;
|
|
45
|
+
|
|
46
|
+
/* At this point, uncompr is still mostly zeroes, so it should compress
|
|
47
|
+
* very well:
|
|
48
|
+
*/
|
|
49
|
+
c_stream.next_in = uncompr;
|
|
50
|
+
c_stream.avail_in = (unsigned int)uncomprLen;
|
|
51
|
+
err = deflate(&c_stream, Z_NO_FLUSH);
|
|
52
|
+
CHECK_ERR(err, "deflate large 1");
|
|
53
|
+
|
|
54
|
+
if (c_stream.avail_in != 0)
|
|
55
|
+
{
|
|
56
|
+
fprintf(stderr, "deflate not greedy\n");
|
|
57
|
+
exit(1);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Feed in already compressed data: */
|
|
61
|
+
c_stream.next_in = compr;
|
|
62
|
+
diff = (unsigned int)(c_stream.next_out - compr);
|
|
63
|
+
c_stream.avail_in = diff;
|
|
64
|
+
|
|
65
|
+
deflate(&c_stream, Z_NO_FLUSH);
|
|
66
|
+
err = deflate(&c_stream, Z_FINISH);
|
|
67
|
+
|
|
68
|
+
if (err != Z_STREAM_END)
|
|
69
|
+
{
|
|
70
|
+
fprintf(stderr, "deflate large should report Z_STREAM_END\n");
|
|
71
|
+
exit(1);
|
|
72
|
+
}
|
|
73
|
+
err = deflateEnd(&c_stream);
|
|
74
|
+
CHECK_ERR(err, "deflateEnd");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Test inflate() with large buffers */
|
|
78
|
+
void test_large_inflate(unsigned char *compr, size_t comprLen,
|
|
79
|
+
unsigned char *uncompr, size_t uncomprLen)
|
|
80
|
+
{
|
|
81
|
+
int err;
|
|
82
|
+
z_stream d_stream; /* decompression stream */
|
|
83
|
+
|
|
84
|
+
d_stream.zalloc = zalloc;
|
|
85
|
+
d_stream.zfree = zfree;
|
|
86
|
+
d_stream.opaque = NULL;
|
|
87
|
+
|
|
88
|
+
d_stream.next_in = compr;
|
|
89
|
+
d_stream.avail_in = (unsigned int)comprLen;
|
|
90
|
+
|
|
91
|
+
err = inflateInit(&d_stream);
|
|
92
|
+
CHECK_ERR(err, "inflateInit");
|
|
93
|
+
|
|
94
|
+
for (;;)
|
|
95
|
+
{
|
|
96
|
+
d_stream.next_out = uncompr; /* discard the output */
|
|
97
|
+
d_stream.avail_out = (unsigned int)uncomprLen;
|
|
98
|
+
err = inflate(&d_stream, Z_NO_FLUSH);
|
|
99
|
+
if (err == Z_STREAM_END)
|
|
100
|
+
break;
|
|
101
|
+
|
|
102
|
+
CHECK_ERR(err, "large inflate");
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
err = inflateEnd(&d_stream);
|
|
106
|
+
CHECK_ERR(err, "inflateEnd");
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size)
|
|
110
|
+
{
|
|
111
|
+
size_t comprLen = 100 + 3 * size;
|
|
112
|
+
size_t uncomprLen = comprLen;
|
|
113
|
+
uint8_t *compr, *uncompr;
|
|
114
|
+
|
|
115
|
+
/* Discard inputs larger than 512Kb. */
|
|
116
|
+
static size_t kMaxSize = 512 * 1024;
|
|
117
|
+
|
|
118
|
+
if (size < 1 || size > kMaxSize)
|
|
119
|
+
return 0;
|
|
120
|
+
|
|
121
|
+
data = d;
|
|
122
|
+
dataLen = size;
|
|
123
|
+
compr = calloc(1, comprLen);
|
|
124
|
+
uncompr = calloc(1, uncomprLen);
|
|
125
|
+
|
|
126
|
+
test_large_deflate(compr, comprLen, uncompr, uncomprLen);
|
|
127
|
+
test_large_inflate(compr, comprLen, uncompr, uncomprLen);
|
|
128
|
+
|
|
129
|
+
free(compr);
|
|
130
|
+
free(uncompr);
|
|
131
|
+
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
#include "catch_amalgamated.hpp"
|
|
2
|
+
#include "../miniz.h"
|
|
3
|
+
#include "miniz_zip.h"
|
|
4
|
+
#include <assert.h>
|
|
5
|
+
#include <string>
|
|
6
|
+
|
|
7
|
+
#ifdef _WIN32
|
|
8
|
+
#define unlink _unlink
|
|
9
|
+
#else
|
|
10
|
+
#include <unistd.h>
|
|
11
|
+
#endif
|
|
12
|
+
|
|
13
|
+
#ifndef MINIZ_NO_STDIO
|
|
14
|
+
bool create_test_zip(const bool zip64)
|
|
15
|
+
{
|
|
16
|
+
unlink("test.zip");
|
|
17
|
+
mz_zip_archive zip_archive = {};
|
|
18
|
+
auto b = mz_zip_writer_init_file_v2(&zip_archive, "test.zip", 0, zip64 ? MZ_ZIP_FLAG_WRITE_ZIP64 : 0);
|
|
19
|
+
if (!b)
|
|
20
|
+
return false;
|
|
21
|
+
|
|
22
|
+
b = mz_zip_writer_add_mem(&zip_archive, "test.txt", "foo", 3, MZ_DEFAULT_COMPRESSION);
|
|
23
|
+
if (!b)
|
|
24
|
+
return false;
|
|
25
|
+
|
|
26
|
+
b = mz_zip_writer_finalize_archive(&zip_archive);
|
|
27
|
+
if (!b)
|
|
28
|
+
return false;
|
|
29
|
+
|
|
30
|
+
b = mz_zip_writer_end(&zip_archive);
|
|
31
|
+
if (!b)
|
|
32
|
+
return false;
|
|
33
|
+
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
TEST_CASE("Zip writer tests")
|
|
38
|
+
{
|
|
39
|
+
auto b = create_test_zip(false);
|
|
40
|
+
REQUIRE(b);
|
|
41
|
+
|
|
42
|
+
SECTION("Test test.txt content correct")
|
|
43
|
+
{
|
|
44
|
+
mz_zip_archive zip_archive = {};
|
|
45
|
+
|
|
46
|
+
auto b = mz_zip_reader_init_file(&zip_archive, "test.zip", 0);
|
|
47
|
+
REQUIRE(b);
|
|
48
|
+
|
|
49
|
+
size_t content_size;
|
|
50
|
+
auto content = mz_zip_reader_extract_file_to_heap(&zip_archive, "test.txt", &content_size, 0);
|
|
51
|
+
|
|
52
|
+
std::string_view content_view(reinterpret_cast<char *>(content), content_size);
|
|
53
|
+
|
|
54
|
+
REQUIRE(content_view == "foo");
|
|
55
|
+
REQUIRE(content_view.size() == 3);
|
|
56
|
+
|
|
57
|
+
free(content);
|
|
58
|
+
|
|
59
|
+
mz_zip_reader_end(&zip_archive);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
SECTION("Test repeated file addition to zip")
|
|
63
|
+
{
|
|
64
|
+
mz_zip_archive zip_archive = {};
|
|
65
|
+
auto b = mz_zip_writer_init_file(&zip_archive, "test2.zip", 0);
|
|
66
|
+
REQUIRE(b);
|
|
67
|
+
|
|
68
|
+
b = mz_zip_writer_finalize_archive(&zip_archive);
|
|
69
|
+
REQUIRE(b);
|
|
70
|
+
|
|
71
|
+
b = mz_zip_writer_end(&zip_archive);
|
|
72
|
+
REQUIRE(b);
|
|
73
|
+
|
|
74
|
+
for (int i = 0; i < 50; i++)
|
|
75
|
+
{
|
|
76
|
+
const char *str = "hello world";
|
|
77
|
+
b = mz_zip_add_mem_to_archive_file_in_place(
|
|
78
|
+
std::string("test2.zip").c_str(), ("file1.txt" + std::to_string(i)).c_str(),
|
|
79
|
+
str, (mz_uint16)strlen(str),
|
|
80
|
+
NULL, 0,
|
|
81
|
+
MZ_BEST_COMPRESSION);
|
|
82
|
+
REQUIRE(b);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
TEST_CASE("Zip reader tests")
|
|
88
|
+
{
|
|
89
|
+
const auto b = create_test_zip(true);
|
|
90
|
+
REQUIRE(b);
|
|
91
|
+
|
|
92
|
+
SECTION("Test zip file reading")
|
|
93
|
+
{
|
|
94
|
+
mz_zip_archive zip_archive = {};
|
|
95
|
+
|
|
96
|
+
auto b = mz_zip_reader_init_file(&zip_archive, "test.zip", 0);
|
|
97
|
+
REQUIRE(b);
|
|
98
|
+
|
|
99
|
+
size_t num_files = mz_zip_reader_get_num_files(&zip_archive);
|
|
100
|
+
REQUIRE(num_files == 1);
|
|
101
|
+
|
|
102
|
+
mz_zip_archive_file_stat file_stat;
|
|
103
|
+
b = mz_zip_reader_file_stat(&zip_archive, 0, &file_stat);
|
|
104
|
+
REQUIRE(b);
|
|
105
|
+
|
|
106
|
+
REQUIRE(file_stat.m_file_index == 0);
|
|
107
|
+
REQUIRE(file_stat.m_uncomp_size == 3);
|
|
108
|
+
REQUIRE(file_stat.m_comp_size == 3);
|
|
109
|
+
REQUIRE(std::string_view(file_stat.m_filename) == "test.txt");
|
|
110
|
+
|
|
111
|
+
mz_zip_reader_end(&zip_archive);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
SECTION("Test central dir overflow")
|
|
115
|
+
{
|
|
116
|
+
auto f = fopen("test.zip", "rb");
|
|
117
|
+
REQUIRE(f);
|
|
118
|
+
char buf[1000];
|
|
119
|
+
const auto read = fread(buf, 1, 1000, f);
|
|
120
|
+
fclose(f);
|
|
121
|
+
|
|
122
|
+
unsigned long long cdir_ofs = -1;
|
|
123
|
+
memcpy(buf + 159, &cdir_ofs, sizeof(cdir_ofs));
|
|
124
|
+
|
|
125
|
+
unlink("test.zip");
|
|
126
|
+
f = fopen("test.zip", "wb");
|
|
127
|
+
REQUIRE(f);
|
|
128
|
+
fwrite(buf, 1, read, f);
|
|
129
|
+
fclose(f);
|
|
130
|
+
|
|
131
|
+
mz_zip_archive zip_archive = {};
|
|
132
|
+
|
|
133
|
+
auto b = mz_zip_reader_init_file(&zip_archive, "test.zip", 0);
|
|
134
|
+
REQUIRE(!b);
|
|
135
|
+
REQUIRE(zip_archive.m_last_error == MZ_ZIP_INVALID_HEADER_OR_CORRUPTED);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
#endif
|
|
140
|
+
|
|
141
|
+
TEST_CASE("Tinfl / tdefl tests")
|
|
142
|
+
{
|
|
143
|
+
SECTION("simple_test1")
|
|
144
|
+
{
|
|
145
|
+
size_t cmp_len = 0;
|
|
146
|
+
|
|
147
|
+
const char *p = "This is a test.This is a test.This is a test.1234567This is a test.This is a test.123456";
|
|
148
|
+
size_t uncomp_len = strlen(p);
|
|
149
|
+
|
|
150
|
+
void *pComp_data = tdefl_compress_mem_to_heap(p, uncomp_len, &cmp_len, TDEFL_WRITE_ZLIB_HEADER);
|
|
151
|
+
REQUIRE(pComp_data);
|
|
152
|
+
|
|
153
|
+
size_t decomp_len = 0;
|
|
154
|
+
void *pDecomp_data = tinfl_decompress_mem_to_heap(pComp_data, cmp_len, &decomp_len, TINFL_FLAG_PARSE_ZLIB_HEADER);
|
|
155
|
+
|
|
156
|
+
REQUIRE(pDecomp_data);
|
|
157
|
+
REQUIRE(decomp_len == uncomp_len);
|
|
158
|
+
REQUIRE(memcmp(pDecomp_data, p, uncomp_len) == 0);
|
|
159
|
+
|
|
160
|
+
free(pComp_data);
|
|
161
|
+
free(pDecomp_data);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
SECTION("simple_test2")
|
|
165
|
+
{
|
|
166
|
+
uint8_t cmp_buf[1024], decomp_buf[1024];
|
|
167
|
+
uLong cmp_len = sizeof(cmp_buf);
|
|
168
|
+
|
|
169
|
+
const char *p = "This is a test.This is a test.This is a test.1234567This is a test.This is a test.123456";
|
|
170
|
+
uLong uncomp_len = (uLong)strlen(p);
|
|
171
|
+
|
|
172
|
+
int status = compress(cmp_buf, &cmp_len, (const uint8_t *)p, uncomp_len);
|
|
173
|
+
REQUIRE(status == Z_OK);
|
|
174
|
+
|
|
175
|
+
REQUIRE(cmp_len <= compressBound(uncomp_len));
|
|
176
|
+
|
|
177
|
+
uLong decomp_len = sizeof(decomp_buf);
|
|
178
|
+
status = uncompress(decomp_buf, &decomp_len, cmp_buf, cmp_len);
|
|
179
|
+
;
|
|
180
|
+
|
|
181
|
+
REQUIRE(status == Z_OK);
|
|
182
|
+
REQUIRE(decomp_len == uncomp_len);
|
|
183
|
+
REQUIRE(memcmp(decomp_buf, p, uncomp_len) == 0);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Copyright 2025 Google LLC
|
|
2
|
+
// Fuzz target for miniz tdefl (tiny deflate) functions
|
|
3
|
+
// Targets: tdefl_compress_mem_to_mem (0% coverage, complexity ~400)
|
|
4
|
+
// tdefl_compress_mem_to_heap (0% coverage)
|
|
5
|
+
// tdefl_write_image_to_png_file_in_memory (0% coverage, complexity 503)
|
|
6
|
+
|
|
7
|
+
#include "miniz.h"
|
|
8
|
+
#include <stdint.h>
|
|
9
|
+
#include <stdlib.h>
|
|
10
|
+
#include <string.h>
|
|
11
|
+
|
|
12
|
+
// Fuzz target for tdefl compression functions
|
|
13
|
+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
|
14
|
+
if (size < 1) return 0;
|
|
15
|
+
|
|
16
|
+
// Determine compression level from input
|
|
17
|
+
tdefl_compress_level compression_level = (tdefl_compress_level)(data[0] % TDEFL_MAX_LEVELS);
|
|
18
|
+
const uint8_t* content = data + 1;
|
|
19
|
+
size_t content_size = size - 1;
|
|
20
|
+
|
|
21
|
+
// Test tdefl_compress_mem_to_mem - 0% coverage target
|
|
22
|
+
if (content_size > 0 && content_size <= 10 * 1024 * 1024) { // Max 10MB
|
|
23
|
+
size_t max_compressed_size = content_size + 1024;
|
|
24
|
+
void* compressed = malloc(max_compressed_size);
|
|
25
|
+
|
|
26
|
+
if (compressed) {
|
|
27
|
+
size_t actual_compressed_size = tdefl_compress_mem_to_mem(
|
|
28
|
+
compressed,
|
|
29
|
+
max_compressed_size,
|
|
30
|
+
content,
|
|
31
|
+
content_size,
|
|
32
|
+
compression_level
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
// If compression succeeded, try decompression
|
|
36
|
+
if (actual_compressed_size > 0 && actual_compressed_size <= max_compressed_size) {
|
|
37
|
+
size_t max_uncompressed = content_size * 2;
|
|
38
|
+
void* uncompressed = malloc(max_uncompressed);
|
|
39
|
+
|
|
40
|
+
if (uncompressed) {
|
|
41
|
+
tinfl_decompress_mem_to_mem(
|
|
42
|
+
uncompressed,
|
|
43
|
+
max_uncompressed,
|
|
44
|
+
compressed,
|
|
45
|
+
actual_compressed_size,
|
|
46
|
+
TINFL_FLAG_PARSE_ZLIB_HEADER
|
|
47
|
+
);
|
|
48
|
+
free(uncompressed);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
free(compressed);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Test tdefl_compress_mem_to_heap - 0% coverage target
|
|
57
|
+
if (content_size > 0 && content_size <= 10 * 1024 * 1024) {
|
|
58
|
+
size_t compressed_size = 0;
|
|
59
|
+
void* heap_compressed = tdefl_compress_mem_to_heap(
|
|
60
|
+
content,
|
|
61
|
+
content_size,
|
|
62
|
+
&compressed_size,
|
|
63
|
+
compression_level
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
if (heap_compressed) {
|
|
67
|
+
// Decompress to verify
|
|
68
|
+
if (compressed_size > 0) {
|
|
69
|
+
size_t uncomp_size = content_size * 2;
|
|
70
|
+
void* uncomp = malloc(uncomp_size);
|
|
71
|
+
if (uncomp) {
|
|
72
|
+
tinfl_decompress_mem_to_mem(
|
|
73
|
+
uncomp,
|
|
74
|
+
uncomp_size,
|
|
75
|
+
heap_compressed,
|
|
76
|
+
compressed_size,
|
|
77
|
+
TINFL_FLAG_PARSE_ZLIB_HEADER
|
|
78
|
+
);
|
|
79
|
+
free(uncomp);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
free(heap_compressed);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Test tdefl_write_image_to_png_file_in_memory - 0% coverage target (complexity 503)
|
|
87
|
+
// This function compresses a grayscale or RGB/RGBA image to PNG format
|
|
88
|
+
if (content_size >= 4) {
|
|
89
|
+
// Try to interpret input as a small image
|
|
90
|
+
// Extract dimensions from first bytes
|
|
91
|
+
int w = (data[0] % 64) + 1; // 1-64 width
|
|
92
|
+
int h = (data[1] % 64) + 1; // 1-64 height
|
|
93
|
+
int num_chans = (data[2] % 4) + 1; // 1-4 channels (grayscale, RGB, RGBA)
|
|
94
|
+
|
|
95
|
+
size_t expected_size = w * h * num_chans;
|
|
96
|
+
if (content_size - 3 >= expected_size && expected_size > 0) {
|
|
97
|
+
const void* image_data = data + 3;
|
|
98
|
+
|
|
99
|
+
size_t png_size = 0;
|
|
100
|
+
void* png_data = tdefl_write_image_to_png_file_in_memory(
|
|
101
|
+
image_data,
|
|
102
|
+
w,
|
|
103
|
+
h,
|
|
104
|
+
num_chans,
|
|
105
|
+
&png_size
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
if (png_data && png_size > 0) {
|
|
109
|
+
free(png_data);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return 0;
|
|
115
|
+
}
|