Source-Changes-HG archive

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

[src/trunk]: src/external/mit/lua/dist/src lua: apply upstream bugfix for "Wr...



details:   https://anonhg.NetBSD.org/src/rev/41937fb29ab5
branches:  trunk
changeset: 374304:41937fb29ab5
user:      nikita <nikita%NetBSD.org@localhost>
date:      Mon Apr 17 20:37:43 2023 +0000

description:
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'.

diffstat:

 external/mit/lua/dist/src/lvm.c |  6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diffs (41 lines):

diff -r 250d27fdcc36 -r 41937fb29ab5 external/mit/lua/dist/src/lvm.c
--- a/external/mit/lua/dist/src/lvm.c   Mon Apr 17 20:33:45 2023 +0000
+++ b/external/mit/lua/dist/src/lvm.c   Mon Apr 17 20:37:43 2023 +0000
@@ -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;
       }



Home | Main Index | Thread Index | Old Index