flutter_zxing icon indicating copy to clipboard operation
flutter_zxing copied to clipboard

ffi: fix use-after-free

Open phlip9 opened this issue 1 year ago • 0 comments

The ImageView borrows from the image buffer in DecodeBarcodeParams -- the newly refactored code frees it too early.

To help prevent some of these issues in the future, we'll be a bit clearer that DecodeBarcodeParams owns the buffer and actually free it in the destructor. Same with EncodeBarcodeParams and contents.

I've also disabled the copy/move constructors so we don't accidentally double free or free a nullptr.

phlip9 avatar Apr 27 '24 05:04 phlip9