Debugger: Fixed crashes with TBL files when unknown characters are present in the TBL file (e.g because it was not UTF-8 encoded)

This commit is contained in:
Sour 2018-09-05 20:51:44 -04:00
parent e995c66927
commit 8019e70483

View file

@ -78,7 +78,9 @@ namespace Be.Windows.Forms
do {
match = false;
foreach(string key in _stringList) {
if(text.StartsWith(key)) {
//Without an ordinal comparison, it's possible for an empty string to "StartsWith" a non-empty string (e.g replacement char U+FFFD)
//This causes a crash here (because key.Length > text.Length)
if(text.StartsWith(key, StringComparison.Ordinal)) {
bytes.AddRange(_reverseTblRules[key].GetBytes());
text = text.Substring(key.Length);
match = true;