]> granicus.if.org Git - nethack/commitdiff
fix github issue #514 - 'O' segfault
authorPatR <rankin@nethack.org>
Fri, 21 May 2021 15:40:39 +0000 (08:40 -0700)
committerPatR <rankin@nethack.org>
Fri, 21 May 2021 15:40:39 +0000 (08:40 -0700)
The #version command retrieves the lua version number to include
in its output, but it was leaving the 'in_lua' flag set.  So if a
later 'O' command tried to complain about a bad option value, the
error reporting routine crashed.

doc/fixes37.0
src/nhlua.c

index 85348a78aa00f2a5049b37830a701a2136815d5e..b2420cd14077bfd7cad3d8fd2cfbbf2a583163af 100644 (file)
@@ -688,6 +688,9 @@ forgetting an item's known/dknown/bknown/&c settings when picked up by unseen
        avoid clearing dknown flag for globs
 fix globby_bill_fixup to use shopkeeper instead of Null for glob pricing
 applying a book to check readability treated novels as if they were spellbooks
+#version was leaving the 'in_lua' flag set and if subsequent 'O' issued an
+       error (example was an attempt to interactively set bouldersym to an
+       invalid value), the error routine reporting crashed via segfault
 
 curses: 'msg_window' option wasn't functional for curses unless the binary
        also included tty support
index d446b3e8c1e590a2d2c4ff843bbe2f78d6c3c36d..a762bf8cd7df568ac75115353a82d8af9ae03ea7 100644 (file)
@@ -1193,7 +1193,7 @@ get_lua_version(void)
                 Strcpy(g.lua_ver, vs);
             }
         }
-        lua_close(L);
+        nhl_done(L);
 #ifdef LUA_COPYRIGHT
         if (sizeof LUA_COPYRIGHT <= sizeof g.lua_copyright)
             Strcpy(g.lua_copyright, LUA_COPYRIGHT);