Module Name:    src
Committed By:   nikita
Date:           Mon Apr 17 20:37:43 UTC 2023

Modified Files:
        src/external/mit/lua/dist/src: lvm.c

Log Message:
lua: apply upstream bugfix for "Wrong line in error message for arithmetic 
errors."

It also causes 'L->top' to be wrong when the error happens,
triggering an 'assert'.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/external/mit/lua/dist/src/lvm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/mit/lua/dist/src/lvm.c
diff -u src/external/mit/lua/dist/src/lvm.c:1.16 src/external/mit/lua/dist/src/lvm.c:1.17
--- src/external/mit/lua/dist/src/lvm.c:1.16	Mon Apr 17 19:35:36 2023
+++ src/external/mit/lua/dist/src/lvm.c	Mon Apr 17 20:37:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lvm.c,v 1.16 2023/04/17 19:35:36 nikita Exp $	*/
+/*	$NetBSD: lvm.c,v 1.17 2023/04/17 20:37:43 nikita Exp $	*/
 
 /*
 ** Id: lvm.c 
@@ -1467,6 +1467,7 @@ void luaV_execute (lua_State *L, CallInf
         vmbreak;
       }
       vmcase(OP_MODK) {
+        savestate(L, ci);  /* in case of division by 0 */
         op_arithK(L, luaV_mod, luaV_modf);
         vmbreak;
       }
@@ -1481,6 +1482,7 @@ void luaV_execute (lua_State *L, CallInf
       }
 #endif /* _KERNEL */
       vmcase(OP_IDIVK) {
+        savestate(L, ci);  /* in case of division by 0 */
         op_arithK(L, luaV_idiv, luai_numidiv);
         vmbreak;
       }
@@ -1527,6 +1529,7 @@ void luaV_execute (lua_State *L, CallInf
         vmbreak;
       }
       vmcase(OP_MOD) {
+        savestate(L, ci);  /* in case of division by 0 */
         op_arith(L, luaV_mod, luaV_modf);
         vmbreak;
       }
@@ -1541,6 +1544,7 @@ void luaV_execute (lua_State *L, CallInf
       }
 #endif /* _KERNEL */
       vmcase(OP_IDIV) {  /* floor division */
+        savestate(L, ci);  /* in case of division by 0 */
         op_arith(L, luaV_idiv, luai_numidiv);
         vmbreak;
       }

Reply via email to