From e01ff415968e36de2dca1184572cbb3e4b6c32cf Mon Sep 17 00:00:00 2001 From: Dan Rosser Date: Sat, 31 Oct 2026 10:09:54 +1100 Subject: [PATCH] FreeImage 3.19.29 --- CHANGELOG.md | 17 ++- CMakeLists.txt | 6 +- FreeImage.rc | 8 +- README.md | 149 ++++++++++++++++--------- Source/FreeImage.h | 2 +- THIRD_PARTY_VERSIONS.md | 6 +- Wrapper/FreeImagePlus/FreeImagePlus.rc | 8 +- 7 files changed, 130 insertions(+), 66 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cf70881..12dbf936 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,22 @@ Release notes for this fork, newest first. The 3.19 line starts from upstream FreeImage 3.19.0 on SVN. -## 3.19.28 — Unreleased +## 3.19.29 — Unreleased + +Large-file TIFF input, stream hardening and Windows build improvements. + +- Add `FreeImage_Load64` and `FreeImage_LoadFromHandle64` with a separate `FreeImageIO64` callback table for single-image TIFF/BigTIFF input beyond 2 GiB and 4 GiB, including header-only loading, Exif metadata and thumbnails. Preserve the existing `FreeImageIO` and external `Plugin` layouts. The new entry points currently support TIFF input only; saving, multipage operations and memory-stream limits are unchanged. (#197, #205) +- Bound memory-stream write end positions before addition, preventing signed overflow and out-of-bounds writes after seeking near `INT_MAX`, especially on Windows. Add a regression test for writes near the position limit. (#228) +- Reject invalid JP2/J2K input stream length probes before decoding, including failed seek/tell callbacks and empty or backwards lengths; retain support for initially empty output streams. (#232) +- Update bundled libaom from 3.15.1 to 3.15.2 for optional HEIF/AVIF builds. (#227) +- Fix Windows resource copyright text across host code pages and add the fork's GitHub URL to resource and runtime copyright information. (#231) +- Reduce warnings from bundled third-party sources under MSVC and avoid redefining LibRaw's `NO_LCMS` macro. (#229) +- Use English diagnostics by default for nested MSVC codec configuration and builds, with `FREEIMAGE_CODEC_ENGLISH_MESSAGES=OFF` to retain localized messages. Add Chinese-language control tests and incremental MSBuild dependency checks. (#236, #237, #241) +- Add optional `vs2022-all` and `vs2026-all` presets that generate a portable CMake-backed Visual Studio solution with Win32, x64, ARM64, ARM64EC and All Platforms selections. Relative source/include paths support moving the whole tree; internal architecture caches are regenerated for the new location. The existing single-architecture presets remain location-specific. Add a Visual Studio build guide and relocation/build CI. (#235, #238, #240) +- Add an experimental Windows ARM64X build and native ARM64 codec smoke tests, including checks for the merged DLL's hybrid relocations. (#210) +- Publish sparse large-file TIFF/BigTIFF fixtures and exercise the new input APIs in cross-platform CI, including malformed callback and truncation cases. Update the openFrameworks integration job to Xcode 27.1. (#197, #233) + +## 3.19.28 — 28 Oct 2026 Security hardening, dependency updates and Windows codec fixes. diff --git a/CMakeLists.txt b/CMakeLists.txt index fa81af50..60f82b18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.16) -# Determine the version from the latest git tag (e.g. "3.19.28"), falling +# Determine the version from the latest git tag (e.g. "3.19.29"), falling # back to a static default when building from a source archive without # .git history (or when git isn't installed). This has to run before # project() below, since its VERSION argument needs a literal # MAJOR.MINOR.PATCH at parse time - it can't be computed afterwards. -set(FREEIMAGE_VERSION_FALLBACK 3.19.28) +set(FREEIMAGE_VERSION_FALLBACK 3.19.29) set(FREEIMAGE_VERSION_COMMITS 0) set(FREEIMAGE_VERSION_HASH "unknown") find_package(Git QUIET) @@ -19,7 +19,7 @@ if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") RESULT_VARIABLE FREEIMAGE_GIT_DESCRIBE_RESULT ) if(FREEIMAGE_GIT_DESCRIBE_RESULT EQUAL 0) - # e.g. "3.19.28-45-ge32af9e" -> tag 3.19.28, 45 commits past it, hash ge32af9e + # e.g. "3.19.29-45-ge32af9e" -> tag 3.19.29, 45 commits past it, hash ge32af9e string(REGEX MATCH "^([0-9]+\\.[0-9]+\\.[0-9]+)-([0-9]+)-(g[0-9a-f]+)$" _fi_ver_match "${FREEIMAGE_GIT_DESCRIBE}") if(_fi_ver_match) set(FREEIMAGE_VERSION ${CMAKE_MATCH_1}) diff --git a/FreeImage.rc b/FreeImage.rc index 136e4917..81dce0c0 100644 --- a/FreeImage.rc +++ b/FreeImage.rc @@ -6,8 +6,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,19,28,0 - PRODUCTVERSION 3,19,28,0 + FILEVERSION 3,19,29,0 + PRODUCTVERSION 3,19,29,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -25,7 +25,7 @@ BEGIN VALUE "Comments", "FreeImage is an Open Source library project for developers who would like to support popular graphics image formats like PNG, BMP, JPEG, TIFF and others as needed by today's multimedia applications.\0" VALUE "CompanyName", "FreeImage\0" VALUE "FileDescription", "FreeImage library\0" - VALUE "FileVersion", "3, 19, 28, 0\0" + VALUE "FileVersion", "3, 19, 29, 0\0" VALUE "InternalName", "FreeImage\0" // Use a wide Unicode escape to avoid the build host's code page. VALUE "LegalCopyright", L"Copyright \x00A9 2003-2026 by FreeImage\0" @@ -33,7 +33,7 @@ BEGIN VALUE "OriginalFilename", "FreeImage.dll\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "FreeImage\0" - VALUE "ProductVersion", "3, 19, 28, 0\0" + VALUE "ProductVersion", "3, 19, 29, 0\0" VALUE "SpecialBuild", "\0" END END diff --git a/README.md b/README.md index c2e181ba..842424f6 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ FreeImage is easy to use, fast, multithreading safe, and cross-platform (works w Security and bug fixes on top of upstream FreeImage, plus a CMake build that compiles FreeImage and every bundled library from one `CMakeLists.txt`. This repository is the source tree. [GitHub releases](https://github.com/danoli3/FreeImage/releases) provide source archives and Linux packages; see the [packaging guide](packaging/README.md). Build a static library or a DLL with the commands in [Building this fork](#building-this-fork). -This tree is FreeImage **3.19.28**. `FreeImage_GetVersion()` prints `FREEIMAGE_MAJOR_VERSION`, `FREEIMAGE_MINOR_VERSION`, and `FREEIMAGE_RELEASE_SERIAL` from `Source/FreeImage.h`. CMake takes the version from the latest numeric git tag (`git describe`) and falls back to 3.19.28 when the archive has no `.git` history. +This tree is FreeImage **3.19.29**. `FreeImage_GetVersion()` prints `FREEIMAGE_MAJOR_VERSION`, `FREEIMAGE_MINOR_VERSION`, and `FREEIMAGE_RELEASE_SERIAL` from `Source/FreeImage.h`. CMake takes the version from the latest numeric git tag (`git describe`) and falls back to 3.19.29 when the archive has no `.git` history. The ANSI C API is usable from C, C++, VB, C#, Delphi, Java, and from scripting languages such as Perl, Python, PHP, TCL, Lua, and Ruby. @@ -92,6 +92,15 @@ cmake --build build -- -j$(nproc) # macOS: -j$(sysctl -n hw.ncpu) ``` **Windows (MSVC, Visual Studio toolchain)** + +Install Visual Studio with **Desktop development with C++**, an x86/x64 MSVC +toolset and a Windows SDK. Add CMake to `PATH`: the presets require CMake +3.21 or newer for VS 2022, or 4.2 or newer for VS 2026. Run the commands below +in PowerShell from the FreeImage source directory. Build Tools supports +command-line builds; opening a solution requires the Visual Studio IDE. + +For an x64 Debug build and tests: + ```powershell cmake --preset vs2022 -A x64 -B build-vs2022-x64 cmake --build build-vs2022-x64 --config Debug @@ -114,9 +123,9 @@ also use the same CRT. For example, to build and test a DLL with the static CRT: ```powershell -cmake -S . -B build -DBUILD_TESTS=ON -DFREEIMAGE_STATIC=OFF -DFREEIMAGE_MSVC_RUNTIME=MT -cmake --build build --config Release -ctest --test-dir build -C Release --output-on-failure +cmake --preset vs2022 -A x64 -B build-vs2022-dll -DFREEIMAGE_STATIC=OFF -DFREEIMAGE_MSVC_RUNTIME=MT +cmake --build build-vs2022-dll --config Release +ctest --test-dir build-vs2022-dll -C Release --output-on-failure ``` MSVC Debug installs include available PDB symbols. Static builds install the @@ -151,79 +160,119 @@ make -j$(nproc) The [complete Visual Studio build guide](doc/visual-studio.md) covers setup, IDE and command-line builds, output paths, testing and installation. -```bash -cmake --preset vs2022 # or: cmake --preset vs2026 +Choose a preset for your Visual Studio version and how you want to build: + +| Build mode | VS 2022 preset | VS 2026 preset | Solution path | +| --- | --- | --- | --- | +| Portable solution with a platform dropdown | `vs2022-all` | `vs2026-all` | `build-vs-all/visualstudio/FreeImage.sln` | +| Single architecture in a fixed build directory | `vs2022` | `vs2026` | `/FreeImage.sln` | + +All four presets run on Windows and enable `BUILD_TESTS`. VS 2026 needs CMake +4.2 or newer. Use `--config Debug` or `--config Release` when building; +`CMAKE_BUILD_TYPE` does not select the configuration for a Visual Studio generator. + +**Portable solution with Win32, x64, ARM64 and ARM64EC** + +```powershell +cmake --preset vs2026-all # For VS 2022: cmake --preset vs2022-all +``` + +Open **`build-vs2026-all/visualstudio/FreeImage.sln`** (or +`build-vs2022-all/visualstudio/FreeImage.sln`). Choose **Win32**, **x64**, +**ARM64**, **ARM64EC**, or **All Platforms** in the platform dropdown, select +Debug or Release, then choose **Build > Build Solution**. All Platforms builds +all four architectures. Install the matching ARM64/ARM64EC C++ toolsets before +building those platforms; ARM64EC requires VS 2022 17.3 or newer. + +To build all four architectures from the command line: + +```powershell +cmake --build build-vs2026-all --config Release --target FreeImageAllPlatforms +``` + +The projects invoke CMake for the selected architecture, so keep CMake on +`PATH` when building from the IDE. Libraries and DLLs are placed under +`build-vs2026-all/visualstudio/artifacts///`. +The combined frontend supports Visual Studio 2022 and 2026 with bundled +dependencies and native MSVC toolchains. + +Choose static libraries, DLLs and optional codecs at configure time. The same +settings apply to every architecture; for example, to generate a DLL solution +with bundled HEIF/AVIF and JPEG XL: + +```powershell +cmake --preset vs2026-all -DFREEIMAGE_STATIC=OFF -DBUILD_LIBHEIF=ON -DBUILD_LIBJXL=ON ``` -Generates a solution under `build-vs2022/` (or `build-vs2026/`). Open `FreeImage.sln` from there. Both presets are Windows-only and turn `BUILD_TESTS` on. `vs2026` needs CMake 4.2 or newer. -For a single architecture, use a separate build directory for each platform: +Use `-DFREEIMAGE_STATIC=ON` for a static library. The +`FREEIMAGE_MSVC_RUNTIME` setting described above also applies to every platform. + +**Moving or sharing the solution** + +The `-all` solution uses relative source and include paths, addressing +[issue #238](https://github.com/danoli3/FreeImage/issues/238). Move or copy the +whole source tree, including `build-vs2026-all/visualstudio/`, while keeping +their relative placement on the same drive. Open the solution at its new +location and build; each machine/location gets fresh architecture caches +under `visualstudio/cache/` automatically. + +Ordinary `vs2022`/`vs2026` solutions and CMake caches contain absolute paths. +After moving their source tree, configure a fresh build directory. To share a +relocatable IDE solution, generate it with a `-all` preset. + +**Single-architecture solutions** + +Use a separate build directory for each architecture: ```powershell -# 32-bit x86 only +# 32-bit x86 cmake --preset vs2026 -A Win32 -B build-vs2026-win32 cmake --build build-vs2026-win32 --config Release -# 64-bit x86 only +# 64-bit x86 cmake --preset vs2026 -A x64 -B build-vs2026-x64 cmake --build build-vs2026-x64 --config Release -# Native ARM64 only +# Native ARM64 cmake --preset vs2026 -A ARM64 -B build-vs2026-arm64 cmake --build build-vs2026-arm64 --config Release -# ARM64EC only +# ARM64EC cmake --preset vs2026 -A ARM64EC -B build-vs2026-arm64ec cmake --build build-vs2026-arm64ec --config Release ``` -Open `FreeImage.sln` in the selected build directory. Each directory has a fixed -architecture and its own CMake cache. Use `--config Debug` for Debug builds. -For Visual Studio 2022, use `--preset vs2022` and corresponding `build-vs2022-*` -directory names. ARM64 and ARM64EC need the matching Visual Studio C++ toolsets; -those executables run on Windows ARM64. +Open `FreeImage.sln` in the selected build directory. For Visual Studio 2022, +replace `vs2026` with `vs2022` in the preset and directory names. For external +SDK toolchains or system codec libraries, use a separate build directory per +architecture. +Choose a new directory when changing the generator or architecture. -For one solution with an architecture dropdown, use: +Run tests and install from a single-architecture build directory. For example, +on x64 Windows: ```powershell -cmake --preset vs2026-all # or: cmake --preset vs2022-all +ctest --test-dir build-vs2026-x64 -C Release --output-on-failure +cmake --install build-vs2026-x64 --config Release --prefix install-vs2026-x64 ``` -Open `build-vs2026-all/visualstudio/FreeImage.sln` (or the corresponding -`vs2022-all` directory). Select **Win32**, **x64**, **ARM64**, **ARM64EC**, or -**All Platforms**, then build Debug or Release. Each architecture has its own -project; All Platforms enables all four projects. The existing -`FREEIMAGE_STATIC` and codec options apply to every architecture. +ARM64 and ARM64EC executables require a compatible Windows ARM64 host. Install +each architecture into a separate prefix; headers go under `include/`, +libraries under `lib/`, and DLLs under `bin/`. + +**Ninja with MSVC** -To build all four architectures directly from CMake: +Run `cmake --preset ninja-msvc` from a Developer Command Prompt or Developer +PowerShell, or after `vcvarsall.bat`, with `cl.exe` and Ninja on `PATH`: ```powershell -cmake --build build-vs2026-all --config Release --target FreeImageAllPlatforms +cmake --preset ninja-msvc +cmake --build build-ninja-msvc +ctest --test-dir build-ninja-msvc --output-on-failure ``` -The combined frontend currently supports **Visual Studio 2022 and 2026**. -VS 2019 is not enabled or validated for this mode. A VS 2019 variant could -cover Win32, x64 and ARM64 with `v142`, but ARM64EC requires -[VS 2022 17.3 or later](https://learn.microsoft.com/en-us/windows/arm/arm64ec-build). - -These are CMake-backed Visual Studio Makefile projects. Building in the IDE -runs CMake with the selected architecture. CMake must be on `PATH`, and the -selected Visual Studio installation needs the matching x86/x64 and ARM64/ARM64EC -C++ toolsets. Outputs are separated under -`visualstudio/artifacts///`. - -The IDE solution, source references, and include paths are relative to the -source tree. You can move/share the whole source tree, including this solution, -while keeping their relative placement. After a move, the first build creates -fresh architecture caches automatically. CMake's internal generated projects -remain in `visualstudio/cache/`; those caches are specific to their location. -The regular `vs2022`/`vs2026` solutions remain ordinary CMake build trees. - -The combined solution supports bundled dependencies and native MSVC toolchains. -For external SDK toolchains or system codec libraries, configure a separate -build tree per architecture. Add `-DFREEIMAGE_VS_ALL_PLATFORMS=ON` to an explicit -Visual Studio configure command to generate the same front end without a preset. - -`cmake --preset ninja-msvc` builds with `cl.exe` and Ninja under `build-ninja-msvc/`. Run it from a Developer Command Prompt, or after `vcvarsall.bat`, so `cl.exe` is on `PATH`. See `CMakePresets.json`. +This preset defaults to Debug. Set `-DCMAKE_BUILD_TYPE=Release` when configuring +a Release build with Ninja. See `CMakePresets.json`. ### Build and install Debug and Release configuration diff --git a/Source/FreeImage.h b/Source/FreeImage.h index 20490ce2..4d0a49bb 100644 --- a/Source/FreeImage.h +++ b/Source/FreeImage.h @@ -32,7 +32,7 @@ #define FREEIMAGE_MAJOR_VERSION 3 #define FREEIMAGE_MINOR_VERSION 19 -#define FREEIMAGE_RELEASE_SERIAL 28 +#define FREEIMAGE_RELEASE_SERIAL 29 // Compiler options --------------------------------------------------------- diff --git a/THIRD_PARTY_VERSIONS.md b/THIRD_PARTY_VERSIONS.md index eade62a5..7980718c 100644 --- a/THIRD_PARTY_VERSIONS.md +++ b/THIRD_PARTY_VERSIONS.md @@ -25,14 +25,14 @@ these libraries has a newer stable upstream release. | ZLib | `Source/ZLib` | 1.3.2 | 1.3.2 | up to date | `zlib.h` | All vendored versions, including OpenEXR's auxiliary codecs below, were -rechecked against source headers on 2026-10-28 for FreeImage 3.19.28. All eight +rechecked against source headers on 2026-10-31 for FreeImage 3.19.29. All eight optional codec archives were verified against the SHA-256 digests in `Source/ThirdParty/sources.json`; release/version files inside the archives were also reviewed. Little CMS 2.19.1 retains `LCMS_VERSION` 2190 in its public header; the bundled archive is the upstream 2.19.1 release artifact. -Since 3.19.27, LibRaw moved from 0.22.2 to 0.22.3, libheif from 1.23.6 to -1.23.7, and Brotli from 1.2.0 to 1.2.1. Other bundled versions are unchanged. +Since 3.19.28, libaom moved from 3.15.1 to 3.15.2. Other bundled versions +are unchanged. OpenEXR, LibDeflate and LibTIFF4 were previously re-synced for #137; OpenEXR 3.5.2 and libpng 1.6.59 followed in #148. diff --git a/Wrapper/FreeImagePlus/FreeImagePlus.rc b/Wrapper/FreeImagePlus/FreeImagePlus.rc index 3657095d..76312053 100644 --- a/Wrapper/FreeImagePlus/FreeImagePlus.rc +++ b/Wrapper/FreeImagePlus/FreeImagePlus.rc @@ -6,8 +6,8 @@ // VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,19,28,0 - PRODUCTVERSION 3,19,28,0 + FILEVERSION 3,19,29,0 + PRODUCTVERSION 3,19,29,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -25,7 +25,7 @@ BEGIN VALUE "Comments", "FreeImage is an Open Source library project for developers who would like to support popular graphics image formats like PNG, BMP, JPEG, TIFF and others as needed by today's multimedia applications.\0" VALUE "CompanyName", "FreeImage\0" VALUE "FileDescription", "FreeImagePlus library\0" - VALUE "FileVersion", "3, 19, 28, 0\0" + VALUE "FileVersion", "3, 19, 29, 0\0" VALUE "InternalName", "FreeImagePlus\0" // Use a wide Unicode escape to avoid the build host's code page. VALUE "LegalCopyright", L"Copyright \x00A9 2003-2026 by FreeImage\0" @@ -33,7 +33,7 @@ BEGIN VALUE "OriginalFilename", "FreeImagePlus.dll\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "FreeImagePlus\0" - VALUE "ProductVersion", "3, 19, 28, 0\0" + VALUE "ProductVersion", "3, 19, 29, 0\0" VALUE "SpecialBuild", "\0" END END