diff options
author | Russ Keldorph <diff.tool> | 2017-04-30 06:17:30 -0700 |
---|---|---|
committer | Russ Keldorph <russ.keldorph@microsoft.com> | 2017-05-03 14:20:19 -0700 |
commit | 1c7e1f4e0b9d338c209a8e73a00c8e9ab42b22e3 (patch) | |
tree | 617f57dadfcc76346d6ff177cb7085dacfbaed3e /src/ilasm | |
parent | e85c2b298e89147d71605c36d9109f87be2b3079 (diff) | |
download | coreclr-1c7e1f4e0b9d338c209a8e73a00c8e9ab42b22e3.tar.gz coreclr-1c7e1f4e0b9d338c209a8e73a00c8e9ab42b22e3.tar.bz2 coreclr-1c7e1f4e0b9d338c209a8e73a00c8e9ab42b22e3.zip |
Fix some static analysis warnings
Most fixes are just addressing the use of (signed) enum-typed variables
as array indices. Casting to unsigned allows us to cheaply include the
lower bound checks in the existing upper bound checks. I would prefer
to force the underlying types of enumerations to be unsigned, but that
is a relatively new C++ feature and could have broader consequences than
I want to risk at this point.
The one other fix to asmparse.cpp just suppresses a warning that, while
technically valid, is not causing a real problem. Perhaps this will get
better if/when #2305 is addressed.
Diffstat (limited to 'src/ilasm')
-rw-r--r-- | src/ilasm/prebuilt/asmparse.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/ilasm/prebuilt/asmparse.cpp b/src/ilasm/prebuilt/asmparse.cpp index 50c62030ff..b3571c72b7 100644 --- a/src/ilasm/prebuilt/asmparse.cpp +++ b/src/ilasm/prebuilt/asmparse.cpp @@ -4,12 +4,13 @@ #line 2 "asmparse.y" - // Licensed to the .NET Foundation under one or more agreements. - // The .NET Foundation licenses this file to you under the MIT license. - // See the LICENSE file in the project root for more information. +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. // // File asmparse.y // + #include "ilasmpch.h" #include "grammar_before.cpp" @@ -1729,7 +1730,7 @@ YYSTATIC YYCONST short yyrecover[] = { #endif /* SCCSWHAT( "@(#)yypars.c 3.1 88/11/16 22:00:49 " ) */ -#line 3 "D:\\ProjectK3\\src\\tools\\devdiv\\x86\\yypars.c" +#line 3 "O:\\tfs\\cgm\\src\\Tools\\devdiv\\amd64\\yypars.c" #if ! defined(YYAPI_PACKAGE) /* ** YYAPI_TOKENNAME : name used for return value of yylex @@ -1852,8 +1853,17 @@ YYLOCAL YYNEAR YYPASCAL YYPARSER() YYAPI_TOKENNAME = YYAPI_TOKENNONE; yystate = 0; - yyps= &yys[-1]; - yypv= &yyv[-1]; + +#ifdef _PREFAST_ +#pragma warning(push) +#pragma warning(disable:6200) // Index '-1' is out of valid index range...for non-stack buffer... +#endif + yyps= &yys[-1]; + yypv= &yyv[-1]; +#ifdef _PREFAST_ +#pragma warning(pop) +#endif + #endif #ifdef YYDUMP @@ -4872,7 +4882,7 @@ case 834: case 835: #line 2045 "asmparse.y" { PASMM->SetManifestResAsmRef(yypvt[-0].string); } break;/* End of actions */ -#line 329 "D:\\ProjectK3\\src\\tools\\devdiv\\x86\\yypars.c" +#line 329 "O:\\tfs\\cgm\\src\\Tools\\devdiv\\amd64\\yypars.c" } } goto yystack; /* stack new state and value */ |