[nostalgia/core] Fix resizeSubsheet array overflow

This commit is contained in:
Gary Talent 2024-11-14 19:59:58 -06:00
parent 5025475414
commit 13bfe88195

View File

@ -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::Error resizeSubsheet(TileSheet::SubSheet &ss, int8_t pBpp, ox::Size const&sz) noexcept {
ox::Vector<uint8_t> out; ox::Vector<uint8_t> out;
oxReturnError(setPixelCount(out, pBpp, static_cast<size_t>(sz.width * sz.height) * PixelsPerTile)); oxReturnError(setPixelCount(out, pBpp, static_cast<size_t>(sz.width * sz.height) * PixelsPerTile));
auto const w = ss.columns * TileWidth; auto const w = sz.width * TileWidth;
auto const h = ss.rows * TileHeight; auto const h = sz.height * TileHeight;
for (auto x = 0; x < w; ++x) { for (auto x = 0; x < w; ++x) {
for (auto y = 0; y < h; ++y) { for (auto y = 0; y < h; ++y) {
auto const palIdx = getPixel(ss, pBpp, {x, y}); auto const palIdx = getPixel(ss, pBpp, {x, y});