Skip to content

Commit

Permalink
Fix for Qiskit#2291
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanro committed Jan 25, 2025
1 parent 0bd1716 commit d37ab9b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
prelude: >
DiagonalFusion::aggregate_operations could crash in some circumstances
fixes:
- |
Sometimes `DiagonalFuson::get_next_deagonal_end` had an invalid `from`
parameter. Now it has a check to return -1 in such a case. For more
details refer to: `#2291 <https://github.com/Qiskit/qiskit-aer/issues/2291>`
3 changes: 3 additions & 0 deletions src/transpile/fusion.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,9 @@ int DiagonalFusion::get_next_diagonal_end(
const oplist_t &ops, const int from, const int end,
std::set<uint_t> &fusing_qubits) const {

if (ops.size() <= from)
return -1;

if (is_diagonal_op(ops[from])) {
for (const auto qubit : ops[from].qubits)
fusing_qubits.insert(qubit);
Expand Down

0 comments on commit d37ab9b

Please sign in to comment.