-
-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Labels
Description
At https://github.com/Toufool/LiveSplit.AutoSplitIntegration/blob/main/UI/Components/AutoSplitProcess.cs#L104
MainProcess = Process.GetProcessById(int.Parse(e.Data));
If AutoSplit sends something else than an number as the second line outputed to the standard output, it'll make LiveSplit crash.
Example:
# Send version and process ID to stdout
print(f"{VERSION}\nNot a number", flush=True)
or
# Send version and process ID to stdout
print("I just wanted a debug log :(")
print(f"{VERSION}\n{os.getpid()}", flush=True)
We need to expect an invalid number format and fail gracefully.
Note that I believe sending a "keyword" + the data (just like we do for settings) is probably best anyway as it would remove dependency on line order.
Full exception from Windows' Event Viewer:
Application: LiveSplit.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.FormatException
at System.Number.StringToNumber(System.String, System.Globalization.NumberStyles, NumberBuffer ByRef, System.Globalization.NumberFormatInfo, Boolean)
at System.Number.ParseInt32(System.String, System.Globalization.NumberStyles, System.Globalization.NumberFormatInfo)
at LiveSplit.UI.Components.AutoSplitProcess.StartupProcess_OutputDataReceived(System.Object, System.Diagnostics.DataReceivedEventArgs)
at System.Diagnostics.Process.OutputReadNotifyUser(System.String)
at System.Diagnostics.AsyncStreamReader.FlushMessageQueue()
at System.Diagnostics.AsyncStreamReader.GetLinesFromStringBuilder()
at System.Diagnostics.AsyncStreamReader.ReadBuffer(System.IAsyncResult)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.IO.Stream+ReadWriteTask.System.Threading.Tasks.ITaskCompletionAction.Invoke(System.Threading.Tasks.Task)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.ExecuteEntry(Boolean)
at System.Threading.ThreadPoolWorkQueue.Dispatch()