Bug 1461595 - Sumwars segfaults with current lua
Sumwars segfaults with current lua
Status: NEW
Product: Fedora
Classification: Fedora
Component: sumwars (Show other bugs)
26
x86_64 Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Martin Preisler
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-14 18:00 EDT by Göran Uddeborg
Modified: 2017-06-14 18:00 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Göran Uddeborg 2017-06-14 18:00:41 EDT
Description of problem:
Sumwars on F26 crashes with a segmentation violation during startup.


Version-Release number of selected component (if applicable):
sumwars-0.5.8-10.fc26.x86_64
lua-5.3.4-3.fc26.x86_64


How reproducible:
Every time


Steps to Reproduce:
1. sumwars


Actual results:
A segmentation violation crash.


Expected results:
The game should start.


Additional info:
I installed the debuginfo packages and took a quick look.  I believe the below code src/code/eventsystem.cpp is guilty.  It initializes m_lua differently depending on the LUA_VERSION_NUM value.  But the lua in F26 sets this value to 503.  None of the cases match, and m_lua remains 0.  The following call of luaL_openlibs can't handle that, it expects it to have a valid value.  Googling a little, it seems the 502 version is to be used in 503 too.  Most likely, changing to "LUA_VERSION_NUM >= 502" is a better fix.

void EventSystem::init()
{
	if (m_lua !=0)
	{
		cleanup();
	}

#if LUA_VERSION_NUM == 501
	m_lua = lua_open();
#elif LUA_VERSION_NUM == 502
    m_lua = luaL_newstate();
#endif

	luaL_openlibs(m_lua);

Note You need to log in before you can comment on or make changes to this bug.