lua-users home
lua-l archive

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


On Sat, Dec 6, 2008 at 10:46 PM, Florian Weimer <fw@deneb.enyo.de> wrote:
> * Sam Roberts:
> It's difficult to reproduce this with the expat binding because it's
> not expected to be reentrant (it just crashes).  If there was a second
> function like parse, I could use the same trick, I think.

> Here's the crasher for the LuaExpat binding (the one at
> <http://www.keplerproject.org/luaexpat/>, I hope it's related to the
> one in PIL):

This is unrelated to the sqlite bug you found. expat itself is
non-reentrant. I suspect you could reproduce this crash in pure C by
calling expat's parse from a callback that parse is calling.

> SQLite already does that.  It doesn't restore the previously stored L
> value after the called SQLite API function returns (which would at
> least fix this particular breakage, I think),

I agree! And you seem to understand the rules very well!

When C is called from lua, it must use the L it was passed. If C calls
back into lua, after lua returns to it, it must use the L it was
originally passed. Still. Even if lua had called back into C. This may
not be easy to arrange, and until coroutines are used creatively, bugs
may never be seen.

What was the question?

Sam