From 6ff349c2f6d7d21f2bbe8d14e096e507429a08c6 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Fri, 24 Jan 2020 15:25:01 -0800 Subject: [PATCH] Fix crashing bug in Goto The application would crash if an invalid file offset was entered (with "+xxxx"). This bug has been present since v1.0. --- SourceGen/WpfGui/GotoBox.xaml.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SourceGen/WpfGui/GotoBox.xaml.cs b/SourceGen/WpfGui/GotoBox.xaml.cs index 3e95c53..5144c99 100644 --- a/SourceGen/WpfGui/GotoBox.xaml.cs +++ b/SourceGen/WpfGui/GotoBox.xaml.cs @@ -136,7 +136,10 @@ namespace SourceGen.WpfGui { if (input[0] == '+') { // this can only be an offset; convert as hexadecimal number try { - TargetOffset = Convert.ToInt32(input.Substring(1), 16); + int offset = Convert.ToInt32(input.Substring(1), 16); + if (offset >= 0 && offset < mProject.FileDataLength) { + TargetOffset = offset; + } } catch (Exception) { } return;