From fcc80c5332ef0ec86b2191b2f7d6439d58da5d35 Mon Sep 17 00:00:00 2001 From: gatecat Date: Mon, 4 May 2026 13:38:04 +0200 Subject: [PATCH] himbaechel: bounds check getBelByLocation Signed-off-by: gatecat --- himbaechel/arch.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/himbaechel/arch.h b/himbaechel/arch.h index 06cb92a7..66edf3a1 100644 --- a/himbaechel/arch.h +++ b/himbaechel/arch.h @@ -513,6 +513,8 @@ struct Arch : BaseArch } BelId getBelByLocation(Loc loc) const override { + if (loc.x < 0 || loc.x >= chip_info->width || loc.y < 0 || loc.y >= chip_info->height) + return BelId(); int tile = tile_by_xy(chip_info, loc.x, loc.y); auto &tile_data = chip_tile_info(chip_info, tile); for (size_t i = 0; i < tile_data.bels.size(); i++) {