Closed suvamM closed 1 year ago
What about this location for same issue?
In reply to: 1532298368
Refers to: src/Sarif/EnumeratedArtifact.cs:43 in 1909293. [](commit_id = 1909293f63b23109b6947ecce63dbd866011cd98, deletion_comment = False)
In another method, FormatForVisualStudio(), there is this:
string path = uri.IsAbsoluteUri && uri.IsFile ? uri.LocalPath : uri.ToString();
Actually in all the other locations where .IsFile is called it has the above pattern for uri.IsAbsoluteUri && uri.IsFile
Isn't this one an issue as well?
In reply to: 1532301809
Refers to: src/Sarif/EnumeratedArtifact.cs:43 in 1909293. [](commit_id = 1909293f63b23109b6947ecce63dbd866011cd98, deletion_comment = False)
In another method, FormatForVisualStudio(), there is this:
string path = uri.IsAbsoluteUri && uri.IsFile ? uri.LocalPath : uri.ToString();
Actually in all the other locations where .IsFile is called it has the above pattern for uri.IsAbsoluteUri && uri.IsFile
Isn't this one an issue as well?
Refers to: src/Sarif/EnumeratedArtifact.cs:43 in 1909293. [](commit_id = 1909293, deletion_comment = False)
@schlaman-ms Do we have an example where this causes an issue?
This PR makes the following fixes:
EnumeratedArtifact
class throws an exception while analyzing certain Linux files. An example file path which reproduces the error isD:/test/file
. The issue arises in theget_SizeInBytes
method:The example file path above is treated as a relative URI, which causes exceptions in
Uri.IsFile
andUri.LocalPath
. The change in this PR checks if the path associated withUri.GetFilePath()
has the attributes of a file or directory (which is expected work across Windows and Linux). I tested this change by doing an analysis in Linux, and no exceptions are thrown.The post-build task of Coyote binary instrumentation does not work in Linux, since it is a powershell script. This causes a build failure in Linux. This PR adds a condition in the post-build task to perform the rewriting only in Windows.