From 27fdb221cb61a96dbfc319dd1dd84b24ced43c87 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 14 Nov 2024 19:59:58 -0600 Subject: [PATCH] [nostalgia/core] Fix resizeSubsheet array overflow --- deps/nostalgia/src/nostalgia/modules/core/src/tilesheet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps/nostalgia/src/nostalgia/modules/core/src/tilesheet.cpp b/deps/nostalgia/src/nostalgia/modules/core/src/tilesheet.cpp index 99428aa..78b0337 100644 --- a/deps/nostalgia/src/nostalgia/modules/core/src/tilesheet.cpp +++ b/deps/nostalgia/src/nostalgia/modules/core/src/tilesheet.cpp @@ -163,8 +163,8 @@ unsigned pixelCnt(TileSheet::SubSheet const&ss, int8_t pBpp) noexcept { ox::Error resizeSubsheet(TileSheet::SubSheet &ss, int8_t pBpp, ox::Size const&sz) noexcept { ox::Vector out; oxReturnError(setPixelCount(out, pBpp, static_cast(sz.width * sz.height) * PixelsPerTile)); - auto const w = ss.columns * TileWidth; - auto const h = ss.rows * TileHeight; + auto const w = sz.width * TileWidth; + auto const h = sz.height * TileHeight; for (auto x = 0; x < w; ++x) { for (auto y = 0; y < h; ++y) { auto const palIdx = getPixel(ss, pBpp, {x, y});