mirror of
https://github.com/github/codeql.git
synced 2026-04-29 18:55:14 +02:00
Merge pull request #5947 from hvitved/csharp/encode-display-name
C#: Encode `"` in `BuildDisplayName`
This commit is contained in:
@@ -373,7 +373,7 @@ namespace Semmle.Extraction.CSharp
|
||||
var elementType = array.ElementType;
|
||||
if (elementType.MetadataName.Contains("`"))
|
||||
{
|
||||
trapFile.Write(elementType.Name);
|
||||
trapFile.Write(TrapExtensions.EncodeString(elementType.Name));
|
||||
return;
|
||||
}
|
||||
elementType.BuildDisplayName(cx, trapFile);
|
||||
@@ -480,7 +480,7 @@ namespace Semmle.Extraction.CSharp
|
||||
}
|
||||
else
|
||||
{
|
||||
trapFile.Write(namedType.Name);
|
||||
trapFile.Write(TrapExtensions.EncodeString(namedType.Name));
|
||||
}
|
||||
|
||||
if (namedType.IsGenericType && namedType.TypeKind != TypeKind.Error && namedType.TypeArguments.Any())
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace Semmle.Extraction
|
||||
return s;
|
||||
}
|
||||
|
||||
private static string EncodeString(string s) => s.Replace("\"", "\"\"");
|
||||
public static string EncodeString(string s) => s.Replace("\"", "\"\"");
|
||||
|
||||
/// <summary>
|
||||
/// Output a string to the trap file, such that the encoded output does not exceed
|
||||
|
||||
Reference in New Issue
Block a user