qir-alliance / pyqir

PyQIR is a set of APIs for generating, parsing, and evaluating Quantum Intermediate Representation (QIR).
https://qir-alliance.github.io/pyqir
MIT License
54 stars 24 forks source link

Fix Module.bitcode() use-after-free #219

Closed bamarsha closed 1 year ago

bamarsha commented 1 year ago

bytes is a slice into a memory buffer that is scoped to the block in let bytes = unsafe { ... };. When PyBytes::new copies it, the memory buffer has already been freed.