[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bug in cpcall
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 11 Mar 2008 11:29:47 -0300
> I believe cpcall does some improper memory handling somewhere because
> it attempts to free an invalid pointer. The attached c code provides a
> reproducible case. The basic idea is to limit the memory usage of a
> lua_State. (Looking at the code) In my application, I don't actually
> have to call cpcall multiple times (it actually happens the first
> time).
In the code that you sent, it seems that the segfault is caused by a
stack overflow. Each cpcall leaves at the stack the error message; if
you do not pop it, they accumulate and overflow the stack. Once you
add a lua_pop inside the loop, the code seems to run without problems.
-- Roberto