lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


define LUA_USE_APICHECK has no help to this problem,

I add some log in function luaD_precall to show what happend:

      StkId base;
      Proto *p = clLvalue(func)->p;

      printf("stack cap = %d , maxstacksize = %d\n", L->stack_last -
L->top, p->maxstacksize);
      /* stack cap = 26 , maxstacksize = 23 */

      luaD_checkstack(L, p->maxstacksize);
      func = restorestack(L, funcr);
      n = cast_int(L->top - func) - 1;  /* number of real arguments */

      printf("stack cap before complete missing arguments = %d\n",
L->stack_last - L->top);
      /* stack cap before complete missing arguments = 26 */

      for (; n < p->numparams; n++)
        setnilvalue(L->top++);  /* complete missing arguments */

      printf("stack cap after complete missing arguments = %d\n",
L->stack_last - L->top);
      /* stack cap after complete missing arguments = 17 */

      base = (!p->is_vararg) ? func + 1 : adjust_varargs(L, p, n);

      printf("L->stack_last - base = %d , maxstacksize = %d\n",
L->stack_last - base, p->maxstacksize);
      /* L->stack_last - base = 17 , maxstacksize = 23 */

      ci = next_ci(L);  /* now 'enter' new function */
      ci->nresults = nresults;
      ci->func = func;
      ci->u.l.base = base;
      ci->top = base + p->maxstacksize;

      printf("L->stack_last - ci->top = %d\n", L->stack_last - ci->top);
      /* L->stack_last - ci->top = -6 */

      lua_assert(ci->top <= L->stack_last);
      /* assert failed */


2013/4/19 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
>> But if I then recall the source code with uparrow and add
>> some characters before "end", such that the code is no
>> longer valid, say `..end`, then I get a segmentation fault.
>
> I cannot reproduce this. I get the expected error message:
>         stdin:4: unexpected symbol near '..'
>
> I cannot reproduce the OP's crash either, even with LUA_USE_APICHECK on.
>



-- 
http://blog.codingnow.com