ref: bde380f38b1d2a57d7d9aa35b7210a47085f41a7
parent: 38e8024ffab83dd0b19f6b0f436d4a589fc87eef
author: ISSOtm <[email protected]>
date: Fri Mar 4 21:13:27 EST 2022
Fix unchecked narrowing conversion of tile IDs The conversion is OK because of the tile amount cap
--- a/src/gfx/convert.cpp
+++ b/src/gfx/convert.cpp
@@ -634,7 +634,7 @@
// 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 @@
TileData::MatchType matchType = TileData::EXACT;
if (inserted) {
// Give the new tile the next available unique ID
- tileData->tileID = tiles.size();
+ tileData->tileID = static_cast<uint16_t>(tiles.size());
// Pointers are never invalidated!
tiles.emplace_back(&*tileData);
} else {