From db5e53543bfd6a30ff85d3fcf2eef6628cfc4f77 Mon Sep 17 00:00:00 2001 From: CodeReclaimers Date: Mon, 16 Feb 2026 17:51:51 -0500 Subject: [PATCH] Fix 16-bit RGB PNG loaded with 8-bit texture format in WICFileIO::Load In the bit_depth==16 / PNG_COLOR_TYPE_RGB branch, the texture was allocated with DF_R8G8B8A8_UNORM instead of DF_R16G16B16A16_UNORM, causing a buffer overrun when writing uint16_t data. Co-Authored-By: Claude Opus 4.6 --- GTE/Applications/GLX/WICFileIO.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GTE/Applications/GLX/WICFileIO.cpp b/GTE/Applications/GLX/WICFileIO.cpp index 4a721e4b..2e9e93fa 100644 --- a/GTE/Applications/GLX/WICFileIO.cpp +++ b/GTE/Applications/GLX/WICFileIO.cpp @@ -3,7 +3,7 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt // https://www.geometrictools.com/License/Boost/LICENSE_1_0.txt -// File Version: 8.0.2025.05.10 +// File Version: 8.0.2026.02.16 // The functions were written based on the example source code // https://dev.w3.org/Amaya/libpng/example.c @@ -201,7 +201,7 @@ std::shared_ptr WICFileIO::Load(std::string const& filename, bool want } else if (color_type == PNG_COLOR_TYPE_RGB) { - texture = std::make_shared(DF_R8G8B8A8_UNORM, width, height, wantMipmaps); + texture = std::make_shared(DF_R16G16B16A16_UNORM, width, height, wantMipmaps); trg = texture->Get(); for (png_uint_32 y = 0; y < height; ++y) {