Re: luajit 2.1 table.sort segmentation fault on OSX and Linux

  • From: Mike Pall <mike-1403@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Thu, 20 Mar 2014 09:46:14 +0100

ivan starkov wrote:
>   local any_struct_ffi = ffi.new("some_struct[?]", 10)
> 
>   for i=0, 10 do
>     sorted[i] = 10-i
>     any_struct_ffi[i].value = i
>   end

The access to any_struct_ffi[10] is out of bounds. Array indexes
in C range from 0 to N-1.

--Mike

Other related posts: