From afb4fa1aeaebf6736d26293709086ffd5cd1b653 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Sun, 3 Mar 2013 13:33:02 +0100 Subject: [PATCH] Fixed memory corruption in subcircuit miner --- libs/subcircuit/subcircuit.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/subcircuit/subcircuit.cc b/libs/subcircuit/subcircuit.cc index 2c6f3d827..0138d5a0f 100644 --- a/libs/subcircuit/subcircuit.cc +++ b/libs/subcircuit/subcircuit.cc @@ -68,8 +68,10 @@ SubCircuit::Graph::Graph(const Graph &other, const std::vector &oth for (auto &i1 : other2this) for (auto &i2 : other.nodes[i1.first].ports) for (auto &i3 : i2.bits) - if (edges2this.count(i3.edgeIdx) == 0) - edges2this[i3.edgeIdx] = edges2this.size(); + if (edges2this.count(i3.edgeIdx) == 0) { + int next_idx = edges2this.size(); + edges2this[i3.edgeIdx] = next_idx; + } edges.resize(edges2this.size()); for (auto &it : edges2this) { -- 2.30.2