Skip to content

Commit

Permalink
Fix path validation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ww898 committed Feb 24, 2021
1 parent 4549791 commit b31c25f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<TargetFramework>net5.0</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)\Subplatform.Snk</AssemblyOriginatorKeyFile>
<Version>1.0.5</Version>
<Version>1.0.6</Version>
</PropertyGroup>
</Project>
33 changes: 17 additions & 16 deletions Core/src/Impl/Commands/Scanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,30 +67,31 @@ public async Task<Statistics> Execute()

private async Task ScanFile([NotNull] string sourceDir, [NotNull] string sourceFile, [NotNull] ITracer tracer, [NotNull] Statistics statistics)
{
var sourceRelativeFile = Path.GetRelativePath(sourceDir, sourceFile);
tracer.Information($" Scanning {sourceRelativeFile}...");
var srcFile = Path.GetRelativePath(sourceDir, sourceFile);
tracer.Information($" Scanning {srcFile}...");
foreach (var key in GetKeyInfos(tracer, statistics, sourceFile))
{
var storageRelativeFile = key.Item1.Index;
if (!SymbolStoreKey.IsKeyValid(storageRelativeFile))
tracer.Error($"Invalid key index in file {storageRelativeFile}");
else if (key.Item2 == KeyType.Elf && Path.GetExtension(sourceFile) == ".debug" && !storageRelativeFile.EndsWith("/_.debug"))
var index = key.Item1.Index;
if (!SymbolStoreKey.IsKeyValid(index))
tracer.Error($"Invalid key index in file {index}");
else if (key.Item2 == KeyType.Elf && Path.GetExtension(sourceFile) == ".debug" && !index.EndsWith("/_.debug"))
{
// Bug: Check that ELF .debug was processed right way! See https://github.com/dotnet/symstore/issues/158
tracer.Error($"ELF file {sourceFile} was processed incorrectly because Microsoft.SymbolStore doesn't support .debug extension");
}
else if (
myCompressWPdb && key.Item2 == KeyType.WPdb ||
myCompressPe && key.Item2 == KeyType.Pe)
{
var packedStorageRelativeFile = Path.ChangeExtension(storageRelativeFile, PathUtil.GetPackedExtension(Path.GetExtension(storageRelativeFile)));
await myProcessCompressed(sourceDir, sourceRelativeFile, packedStorageRelativeFile);
if (myIsKeepNonCompressed)
await myProcessNormal(sourceDir, sourceRelativeFile, storageRelativeFile);
}
else
{
await myProcessNormal(sourceDir, sourceRelativeFile, storageRelativeFile);
var dstFile = index.NormalizeSystem();
if (
myCompressWPdb && key.Item2 == KeyType.WPdb ||
myCompressPe && key.Item2 == KeyType.Pe)
{
await myProcessCompressed(sourceDir, srcFile, Path.ChangeExtension(dstFile, PathUtil.GetPackedExtension(Path.GetExtension(dstFile))));
if (myIsKeepNonCompressed)
await myProcessNormal(sourceDir, srcFile, dstFile);
}
else
await myProcessNormal(sourceDir, srcFile, dstFile);
}
}
}
Expand Down

0 comments on commit b31c25f

Please sign in to comment.