eclipse / xacc

XACC - eXtreme-scale Accelerator programming framework
https://xacc.readthedocs.io
BSD 3-Clause "New" or "Revised" License
165 stars 85 forks source link

Potential unsafe C-U application with gray_code_mcu_gen #514

Closed 1tnguyen closed 2 years ago

1tnguyen commented 2 years ago

In __gray_code_mcu_gen, we query getBufferNames()[0] directly without checking if the buffer name array is not empty (https://github.com/eclipse/xacc/blob/master/quantum/plugins/algorithms/qpe/ControlledGateApplicator.cpp#L176).

This could be unsafe and we need to fallback to generic buffer name, e.g. "q", if the instruction does not have any buffer names.