Re: LuaJIT segfault
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: LuaJIT segfault
- From: Pierre Chapuis <catwell@...>
- Date: 2011年11月08日 11:42:58 +0100
On 08.11.2011 11:30, Daurnimator wrote:
See http://luajit.org/ext_ffi_semantics.html#init
Byte arrays may also be initialized with a Lua string. This copies
the
whole string plus a terminating zero-byte. The copy stops early only
if the array has a known, fixed size.
I guess a VLA (A variable-length array) is not of a known, fixed
size.
(though I guess it should be.....)
My reasoning is: I'm using nelem
(http://luajit.org/ext_ffi_api.html#ffi_new) to copy a string that
represents raw bytes (and has no reason to be 0円-terminated).
It should behave approximately like strncpy().
But what I find the most strange is that the segfault doesn't happen
at that line, it happens later when the memory is garbage collected.
--
Pierre Chapuis