Jump to content

net.dostring_in("mission", "a_do_script(...)") causes SEGFAULT with non-scalar return values


Recommended Posts

Posted (edited)

Clean (no mods, no scripts), freshly repaired (full verification) DCS 2.9.13.6818 install. Running the following Lua code will cause a segmentation fault (ACCESS_VIOLATION):

local res = {net.dostring_in("mission", [[
	return {a_do_script("return {1, 2, 3, 4}", 1, 2, 3, 4)}
]])}

Steps to reproduce:

  1. Save segfault_a_do_script.lua in %USERPROFILE%\Saved Games\DCS.openbeta\Scripts\Hooks\
  2. Run an arbitrary mission from the mission editor.
  3. Game should crash with a "DCS Crash" popup once loading completes.

Crash trace for comparison: dcs.20250224-084219.crash

How did I stumble upon this? I got curious what the updated a_do_script() can do and started messing around with it. Quote from the changelog:

Quote

Scripting API. Added possibility to pass args and return values from mission scripting a_do_script() and a_do_file() APIs.

Edited by Actium
  • 4 weeks later...
  • 4 weeks later...
Posted

I was using this in my server and now i can't see any returned values ...  is there any other way i should be using this sentence?  

local safeScript = escape_lua_string(script)
local result = net.dostring_in("mission", " return a_do_script( \"" ..  safeScript .. "\" )" )

This was working before the update..

Posted

@Flappie I can confirm that the fix presumably broke the underlying scripting feature entirely. Removed the solution mark.

@MarcosR I took the liberty to create a separate bug report for the issue you discovered, as it is kinda off topic here: 

 

  • Thanks 1
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...