Browse Source

Clarify reading of UTF8 null-terminated strings in `TryGetExtraTypeInfo`

pull/3114/head
ElektroKill 1 year ago
parent
commit
eefb46688d
No known key found for this signature in database
GPG Key ID: 7E3C5C084E40E3EC
  1. 2
      ICSharpCode.ILSpyX/PdbProvider/PortableDebugInfoProvider.cs

2
ICSharpCode.ILSpyX/PdbProvider/PortableDebugInfoProvider.cs

@ -204,8 +204,10 @@ namespace ICSharpCode.ILSpyX.PdbProvider @@ -204,8 +204,10 @@ namespace ICSharpCode.ILSpyX.PdbProvider
var list = new List<string?>();
while (reader.RemainingBytes > 0)
{
// Read a UTF8 null-terminated string
int length = reader.IndexOf(0);
string s = reader.ReadUTF8(length);
// Skip null terminator
reader.ReadByte();
list.Add(string.IsNullOrWhiteSpace(s) ? null : s);
}

Loading…
Cancel
Save