aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaire Wolf <clifford@clifford.at>2020-06-25 18:26:00 +0200
committerGitHub <noreply@github.com>2020-06-25 18:26:00 +0200
commitcc24caa4c63f185615eb66e7a658812763fb50dc (patch)
tree4e2e52f6a99ae709dd10f0f23e7b41fcce5fb318
parent3ce267300984b0163307d1cf0c400af1d354a17a (diff)
parent4590de5c7f221aa1ae4d11fd98af439241f4258f (diff)
downloadicestorm-cc24caa4c63f185615eb66e7a658812763fb50dc.tar.gz
icestorm-cc24caa4c63f185615eb66e7a658812763fb50dc.tar.bz2
icestorm-cc24caa4c63f185615eb66e7a658812763fb50dc.zip
Merge pull request #254 from per-gron/fix-oob
Fix array out of bounds access bug
-rw-r--r--icetime/icetime.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/icetime/icetime.cc b/icetime/icetime.cc
index 0735b00..9026c7c 100644
--- a/icetime/icetime.cc
+++ b/icetime/icetime.cc
@@ -62,16 +62,16 @@ std::map<int, std::string> net_symbols;
bool get_config_bit(int tile_x, int tile_y, int bit_row, int bit_col)
{
- if (int(config_bits.size()) < tile_x)
+ if (int(config_bits.size()) <= tile_x)
return false;
- if (int(config_bits[tile_x].size()) < tile_y)
+ if (int(config_bits[tile_x].size()) <= tile_y)
return false;
- if (int(config_bits[tile_x][tile_y].size()) < bit_row)
+ if (int(config_bits[tile_x][tile_y].size()) <= bit_row)
return false;
- if (int(config_bits[tile_x][tile_y][bit_row].size()) < bit_col)
+ if (int(config_bits[tile_x][tile_y][bit_row].size()) <= bit_col)
return false;
return config_bits[tile_x][tile_y][bit_row][bit_col];