[PATCH] D67793: new api class: SBFile

Vadim Chugunov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 10 00:36:47 PST 2020


vadimcn added inline comments.


================
Comment at: lldb/trunk/scripts/Python/python-typemaps.swig:481
+  PyBuffer_Release(&view);
+  $1 = ($1_ltype) buf;
+  $2 = ($2_ltype) (size/sizeof($*1_type));
----------------
Sorry for being late to the party, but I just stumbled upon this code...  

It seems to return a pointer from a view that had just been released.  Isn't this kind of risky?   While most of the time buffer views point into object's internal memory, buffer protocol does not prohibit allocating memory just to fulfill the buffer request.  In which case PyBuffer_Release would be expected to release that memory, leaving the caller with a dangling pointer.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67793/new/

https://reviews.llvm.org/D67793





More information about the llvm-commits mailing list