Browse Source

Fixed SD2-1092: FxCop Crashed #Develop while checking Serrlongue source code.

MSBuild loggers need to check for a valid filename before passing it to the System.IO.Path.* methods.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2018 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Christian Hornung 19 years ago
parent
commit
888070dcda
  1. 4
      src/AddIns/Misc/CodeAnalysis/Src/FxCopLogger.cs
  2. 2
      src/Main/Base/Project/Src/Project/MSBuildEngine.cs

4
src/AddIns/Misc/CodeAnalysis/Src/FxCopLogger.cs

@ -7,6 +7,7 @@
using System; using System;
using System.IO; using System.IO;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project; using ICSharpCode.SharpDevelop.Project;
@ -85,7 +86,8 @@ namespace ICSharpCode.CodeAnalysis
{ {
string[] moreData = (subcategory ?? "").Split('|'); string[] moreData = (subcategory ?? "").Split('|');
BuildError err = engine.CurrentErrorOrWarning; BuildError err = engine.CurrentErrorOrWarning;
if (Path.GetFileName(file) == "SharpDevelop.CodeAnalysis.targets") { if (FileUtility.IsValidFileName(file) &&
Path.GetFileName(file) == "SharpDevelop.CodeAnalysis.targets") {
err.FileName = null; err.FileName = null;
} }
IProject project = ProjectService.GetProject(engine.CurrentProjectFile); IProject project = ProjectService.GetProject(engine.CurrentProjectFile);

2
src/Main/Base/Project/Src/Project/MSBuildEngine.cs

@ -371,7 +371,7 @@ namespace ICSharpCode.SharpDevelop.Project
{ {
if (string.Equals(file, activeTaskName, StringComparison.InvariantCultureIgnoreCase)) { if (string.Equals(file, activeTaskName, StringComparison.InvariantCultureIgnoreCase)) {
file = ""; file = "";
} else { } else if (FileUtility.IsValidFileName(file)) {
bool isShortFileName = file == Path.GetFileNameWithoutExtension(file); bool isShortFileName = file == Path.GetFileNameWithoutExtension(file);
if (engine.CurrentProjectFile != null) { if (engine.CurrentProjectFile != null) {
file = Path.Combine(Path.GetDirectoryName(engine.CurrentProjectFile), file); file = Path.Combine(Path.GetDirectoryName(engine.CurrentProjectFile), file);

Loading…
Cancel
Save