lua-users home
lua-l archive

Re: Potential bug in Lua when hooking functions

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


On 2009年7月20日 14:37:22 +0100
Jonathan Shaw <Jonathan.Shaw@microsoft.com> wrote:
> Forgive my ignorance, but how would a traditional diff be best
> displayed in a text only format?
Traditionally, using the diff tool. For your patch, it generates the
following;
diff -aru lua-5.1.4/src/lvm.c lua-5.1.4-yeild-fix/src/lvm.c
--- lua-5.1.4/src/lvm.c	2009年03月20日 18:03:04.517261443 +0000
+++ lua-5.1.4-yeild-fix/src/lvm.c	2009年07月20日 14:44:18.067091491
+0100 @@ -616,11 +616,14 @@
 StkId ra;
 if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) &&
 (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) {
+ const lu_byte saved_status = L->status;
+ L->status = 0;
 traceexec(L, pc);
 if (L->status == LUA_YIELD) { /* did hook yield? */
 L->savedpc = pc - 1;
 return;
 }
+ L->status = saved_status;
 base = L->base;
 }
 /* warning!! several calls may realloc the stack and invalidate `ra' */
(Incidentally, in my copy of Lua 5.1.4, this region starts around line
620, not on line 388; have you modified your copy of Lua in other ways?)
B.

AltStyle によって変換されたページ (->オリジナル) /