From bde380f38b1d2a57d7d9aa35b7210a47085f41a7 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Sat, 5 Mar 2022 02:13:27 +0100 Subject: [PATCH] Fix unchecked narrowing conversion of tile IDs The conversion is OK because of the tile amount cap --- src/gfx/convert.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gfx/convert.cpp b/src/gfx/convert.cpp index 0a0f84e6..c91a565f 100644 --- a/src/gfx/convert.cpp +++ b/src/gfx/convert.cpp @@ -634,7 +634,7 @@ class TileData { // non-pathological cases. uint16_t _hash; public: - mutable size_t tileID; + mutable uint16_t tileID; TileData(Png::TilesVisitor::Tile const &tile, Palette const &palette) : _hash(0) { size_t writeIndex = 0; @@ -719,7 +719,7 @@ struct UniqueTiles { TileData::MatchType matchType = TileData::EXACT; if (inserted) { // Give the new tile the next available unique ID - tileData->tileID = tiles.size(); + tileData->tileID = static_cast(tiles.size()); // Pointers are never invalidated! tiles.emplace_back(&*tileData); } else {