lua-users home
lua-l archive

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



Hi all,

I am in need of some insight into the lua source. When Hans was
attempting to profile the running speed of luatex, it turned out
that the executable sometimes started segfaulting when
debug.getinfo(2,"Sn") was used.

I tracked the immediate cause of the crash down to this
bit of code code in ldebug.c:

  static int currentpc (lua_State *L, CallInfo *ci) {
    if (!isLua(ci)) return -1;
    if (ci == L->ci)
      ci->savedpc = L->savedpc;
    return pcRel(ci->savedpc, ci_func(ci)->l.p);
  }

In some cases, ci->savedpc is apparently NULL, and the result
of pcRel() is then an invalid index. I 'fixed' the problem by
adding an extra line inbetween:

  if (ci->savedpc==NULL) return -1;

However, that is unlikely to be the final fix.

I assume the real cause is an error in the use of lua in the luatex
program, but I do not have the faintest clue what is going on here,
so I hope someone can explain to me in what direction to look. Under
what conditions would this 'ci->savedpc' possibly be NULL?


TIA,
Taco