lua-users home
lua-l archive

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

> Upgrading to 0.11 unfortunately caused a seg fault for me. After some
> hunting I found that the pattern causing the problem was the LPeg
> parser for Moonscript. I've uploaded an butchered standalone version
> of the parser here:
> Simply running this with lua <file> reproduces the seg fault for me
> (tried with latest LuaJIT as well as Lua 5.1.5). The resulting trace
> is this:
> Program terminated with signal 11, Segmentation fault.
> [...]

I had just corrected a bug in LPeg that is probably the cause of
this seg fault. Mainly, the loop in the peephole function should
be this:

-  for (i = 0; i < compst->ncode; i++) {
+  for (i = 0; i < compst->ncode; i += sizei(&code[i])) {

(Function 'sizei' is currently defined in 'lpprint.c'...)

The 'correctcalls' function has a similar bug:

-  for (i = from; i < to; i++) {
+  for (i = from; i < to; i += sizei(&code[i])) {

I am going to prepare a new release in a few days. (I am trying to
remove the current size limit on patterns.)

-- Roberto