diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-05-13 08:55:43 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-05-13 08:55:43 -0700 |
commit | b0c58add3f8ad3da79c6c536925cc7377d59612b (patch) | |
tree | c49a499fc3fa1c4eb92be63b279e2d3cb6a96c90 /tests/014 | |
parent | 39855e5aa9ffd3eac89a8ada790fcb5555bc3f65 (diff) | |
download | txr-b0c58add3f8ad3da79c6c536925cc7377d59612b.tar.gz txr-b0c58add3f8ad3da79c6c536925cc7377d59612b.tar.bz2 txr-b0c58add3f8ad3da79c6c536925cc7377d59612b.zip |
ffi: null out all freed or borrowed pointers.
When taking ownership of any pointer from FFI space, null it
out. This is safer in general and prevents corruption
problems in the callback interface when an exception is
thrown. For instance (ptr wstr-d) callback argument:
callback takes ownership of the pointer in a string object;
throws an exception. The FFI call dispatch runs the in
semantics to get the string value out; but the old pointer
is still there which may not be used.
* ffi.c (ffi_str_d_get, ffi_wstr_d_get, ffi_bstr_d_get,
ffi_buf_d_in, ffi_buf_d_get, ffi_ptr_d_get): Overwrite
the source location of a freed or owned pointer with
null.
Diffstat (limited to 'tests/014')
0 files changed, 0 insertions, 0 deletions