[Lldb-commits] [PATCH] D67793: new api class: SBFile
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Jan 13 02:59:48 PST 2020
labath 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));
----------------
vadimcn wrote:
> 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.
Yes, that does seem worrying, though the swig typemap also does the same thing (but it could have the same bug too). @lawrence_danna, do you know anything about this? Should the buffer be released after the function returns (in the "out" typemap, I guess)?
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67793/new/
https://reviews.llvm.org/D67793
More information about the lldb-commits
mailing list