summaryrefslogtreecommitdiff
path: root/src/ilasm
diff options
context:
space:
mode:
authorKyungwoo Lee <kyulee@microsoft.com>2015-12-24 06:51:55 -0800
committerKyungwoo Lee <kyulee@microsoft.com>2015-12-28 14:25:04 -0800
commiteea8e4800e5c6b708dc27e2add361be8d874b3be (patch)
treeda6381f92d53575a193ac1217ecbbb8d3a367b6a /src/ilasm
parent4e6629d817e832c13dc09ce8f034b04d2f38230e (diff)
downloadcoreclr-eea8e4800e5c6b708dc27e2add361be8d874b3be.tar.gz
coreclr-eea8e4800e5c6b708dc27e2add361be8d874b3be.tar.bz2
coreclr-eea8e4800e5c6b708dc27e2add361be8d874b3be.zip
Fix assertion in ilasm
This is a simple fix for incorrect assertion. Assertion location is changed and dwErrorIndex is zero-initialized. ilasm on coreclr does not handle permission set/security attribute which coreclr does not support. So, such attempt will end up with emitting error on coreclr instead of failing to assert.
Diffstat (limited to 'src/ilasm')
-rw-r--r--src/ilasm/assembler.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/ilasm/assembler.cpp b/src/ilasm/assembler.cpp
index 275b721f36..2398ba92f6 100644
--- a/src/ilasm/assembler.cpp
+++ b/src/ilasm/assembler.cpp
@@ -2274,7 +2274,7 @@ void Assembler::EmitSecurityInfo(mdToken token,
mdTypeRef tkTypeRef;
BinStr *pSig;
char *szMemberName;
- DWORD dwErrorIndex;
+ DWORD dwErrorIndex = 0;
if (pPermissions) {
@@ -2320,18 +2320,15 @@ void Assembler::EmitSecurityInfo(mdToken token,
uCount,
&dwErrorIndex)))
{
+ _ASSERT(uCount >= dwErrorIndex);
if (dwErrorIndex == uCount)
{
report->error("Failed to define security attribute set for 0x%08X\n", token);
}
else
{
- _ASSERT(uCount > dwErrorIndex);
- if (uCount > dwErrorIndex)
- {
- report->error("Failed to define security attribute set for 0x%08X\n (error in permission %u)\n",
- token, uCount - dwErrorIndex);
- }
+ report->error("Failed to define security attribute set for 0x%08X\n (error in permission %u)\n",
+ token, uCount - dwErrorIndex);
}
}
delete [] pAttrs;