Skip to content

Commit 6b96039

Browse files
authored
Update StaticAnalyzer & address errors (#525)
* Add antimalware and psscriptanalyzer * Attempt to address existing static analysis errors * Fix displayname
1 parent e7020cd commit 6b96039

File tree

5 files changed

+105
-3
lines changed

5 files changed

+105
-3
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
# Job Template: Run AntiMalware Analysis
5+
6+
jobs:
7+
- job: CodeAnaysis_AntiMalware
8+
displayName: Code Analysis - AntiMalware
9+
10+
pool:
11+
name: VSEngSS-MicroBuild2022-1ES
12+
13+
workspace:
14+
clean: all
15+
16+
steps:
17+
- checkout: self
18+
clean: true
19+
20+
- task: DownloadBuildArtifacts@0
21+
displayName: Download Windows Files (Release)
22+
inputs:
23+
downloadType: single
24+
artifactName: binaries-windows-Release
25+
downloadPath: $(Build.ArtifactStagingDirectory)
26+
27+
# Run AntiMalware on source
28+
- task: AntiMalware@4
29+
displayName: Run AntiMalware on Source
30+
inputs:
31+
InputType: Basic
32+
ScanType: CustomScan
33+
FileDirPath: $(Build.SourcesDirectory)
34+
continueOnError: true
35+
36+
# Run AntiMalware on artifacts
37+
- task: AntiMalware@4
38+
displayName: Run AntiMalware on Artifacts
39+
inputs:
40+
InputType: Basic
41+
ScanType: CustomScan
42+
DisableRemediation: false
43+
FileDirPath: $(Build.ArtifactStagingDirectory)
44+
continueOnError: true
45+
46+
# Publish SecurityAnalysis Logs
47+
- template: ../../steps/codeanalysis/publishreports.yaml
48+
parameters:
49+
ArtifactName: AntiMalware
50+
51+
- template: ../../steps/codeanalysis/filebugs.yaml
52+
parameters:
53+
BuildName: AntiMalware
54+
Tags: CLRIEAntiMalware
55+
56+
# Microbuild Cleanup
57+
- template: ../../steps/microbuild/cleanup.yaml
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
# Job Template: Run PS Script Code Analysis
5+
# Invokes PS Script analysis
6+
7+
jobs:
8+
- job: CodeAnaysis_PSScriptAnalyzer
9+
displayName: Code Analysis - PSScriptAnalyzer
10+
11+
pool:
12+
name: VSEngSS-MicroBuild2022-1ES
13+
14+
workspace:
15+
clean: all
16+
17+
steps:
18+
- checkout: self
19+
clean: true
20+
21+
# Run PSScriptAnalyzer
22+
- task: PSScriptAnalyzer@1
23+
displayName: 'Run PSScriptAnalyzer'
24+
inputs:
25+
Path: '$(Build.SourcesDirectory)'
26+
Settings: required
27+
IgnorePattern: .gdn
28+
Recurse: true
29+
continueOnError: true
30+
31+
# Publish SecurityAnalysis Logs
32+
- template: ../../steps/codeanalysis/publishreports.yaml
33+
parameters:
34+
ArtifactName: PSScriptAnalyzer
35+
36+
- template: ../../steps/codeanalysis/filebugs.yaml
37+
parameters:
38+
BuildName: PSScriptAnalyzer
39+
Tags: CLRIEPSScriptAnalyzer
40+
41+
# Microbuild Cleanup
42+
- template: ../../steps/microbuild/cleanup.yaml

build/yaml/pipelines/codeanalysis.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ stages:
3939

4040
jobs:
4141
- template: ../jobs/codeanalysis/policheck.yaml
42+
- template: ../jobs/codeanalysis/psscriptanalyzer.yaml
4243

4344
- stage: Analyze_PostBuild
4445
displayName: Code Analysis (After Build)
@@ -47,6 +48,7 @@ stages:
4748
jobs:
4849
- template: ../jobs/codeanalysis/apiscan.yaml
4950
- template: ../jobs/codeanalysis/binskim.yaml
51+
- template: ../jobs/codeanalysis/antimalware.yaml
5052

5153
- stage: Run_CS_Analyzers
5254
displayName: Code Analysis (Build Time Managed)

src/Tests/InstrEngineTests/NaglerInstrumentationMethod/InstrumentationEngineApi.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ namespace InstrumentationEngineApi
5252
#else
5353
// Aid in finding the line of code associated with the error message:
5454
// stderr: The specified module could not be found.
55-
wchar_t err[256];
55+
WCHAR err[256];
5656
memset(err, 0, 256);
5757
FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), err, 255, NULL);
58-
AssertLogFailure(err);
58+
LPCWSTR errMsg = err;
59+
AssertLogFailure(errMsg);
5960
#endif
6061
}
6162

src/Tests/InstrEngineTests/NaglerInstrumentationMethod/NaglerInstrumentationMethod.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ HRESULT CInstrumentationMethod::InstrumentMethod(_In_ IMethodInfo* pMethodInfo,
10231023

10241024
IfFailRet(spIMetaDataEmit->DefineMemberRef(tkTypeToken, spPointTo->m_methodName.c_str(), pSignature, cbSignature, &tkMethodToken));
10251025
}
1026-
else if (FAILED(hrFound))
1026+
else
10271027
{
10281028
IfFailRet(hrFound);
10291029
}

0 commit comments

Comments
 (0)