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
  • 2 months later...
Posted

The return value pass-thru is still broken as of DCS 2.9.17.11733. I'd have liked to report that in the separate post I created for that issue, but, unfortunately, it was closed.

Posted
22 hours ago, Flappie said:

Yes, all bugs don't get fixed in the next update unfortunately. It's on the devs todo-list.

Certainly. I'm not pushing either. Just wanted to a) report to those not privy to the ED-internal bug tracker or todo list that the bug is still present and b) express my displeasure about the forum post reporting said bug being closed, which, unfortunately, prevents distributing up-to-date information, e.g., that a workaround is feasible for those who might need it. I fail to see the logic behind immediately closing forum posts that report game bugs.

  • Recently Browsing   0 members

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