[Commits] [wesnoth/wesnoth] 806a38: fix lua crashing after an lua error

GitHub noreply at github.com
Sat Oct 22 13:28:06 UTC 2016


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: 806a388b9d39707fa293b6747598d04bf2633a36
      https://github.com/wesnoth/wesnoth/commit/806a388b9d39707fa293b6747598d04bf2633a36
  Author: gfgtdf <daniel.gfgtdf at gmail.com>
  Date:   2016-10-22 (Sat, 22 Oct 2016)

  Changed paths:
    M src/scripting/lua_common.cpp

  Log Message:
  -----------
  fix lua crashing after an lua error

This fixes https://github.com/wesnoth/wesnoth/commit/797613f760d0c84afefa39b305bb512f4a574479

which changed the luaW_pcall code from.

 if(lua_pcall(..)) {
   ...
   lua_pop(L, 2);
   return;
 }
 lua_remove(L, error_handler_index);

to

 int r = lua_pcall(..);
 lua_remove(L, error_handler_index);
 if(r) {
   ...
   lua_pop(L, 2);
   return;
 }

so that three values were removed from the stack in case of an error which caused random segfaults later.





More information about the Commits mailing list