summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-26 14:10:34 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-26 14:10:34 +0100
commit0e78cc0bef93f4b89a6a187e11c6c9be1e385352 (patch)
tree68ec1a36da0c8e94f00f676ff60be3f3ef9fbc86
parent2443202f9c722a314528153f0f8823858d1e5389 (diff)
editor: fix out of bounds read off by 1
-rw-r--r--editor/draw.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/editor/draw.cpp b/editor/draw.cpp
index dd4cf96b..5ee54863 100644
--- a/editor/draw.cpp
+++ b/editor/draw.cpp
@@ -56,7 +56,7 @@ clickable_scenery* app::find_clickable_scenery(Vector2i pixel_)
const auto pos_ = pixel - c.dest.min() + c.src.min();
const auto pos = c.atlas.group(c.item.r).mirror_from.isEmpty()
? pos_
- : Vector2ui(c.src.sizeX() - pos_[0], pos_[1]);
+ : Vector2ui(c.src.sizeX() - 1 - pos_[0], pos_[1]);
const auto stride = c.atlas.info().pixel_size[0];
std::size_t idx = pos.y() * stride + pos.x();
fm_debug_assert(idx < c.bitmask.size());