Prefast not detecting SAL errors
-
Mittwoch, 7. September 2011 15:29
Visual Studio 2008 9.0.30729.1 SP
.NET Framework 3.5 SP1
WinDDK 7600.16385.1
The Prefast option resolves to the following call:
Prefast /list /filter “/FilterPreset=(all defects)” build.exe -cZ
Unreachable code and use of NULL pointers are reported so Prefast is running, but incorrect use of SALs are not reported.
We are using the "__in" variety. I guess I'm missing something fairly fundamental.
Alle Antworten
-
Donnerstag, 8. September 2011 08:06ModeratorMay I know your code snippet?
Eric Yang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

-
Donnerstag, 8. September 2011 08:36
There are no warnings for:
void OverwriteIt (__in_bcount (length) char* buffer, __in size_t length)
{
buffer [length+2] = 0;
buffer [100] = 0;
}
There is an "inconsistent use" warning for:
void OverwriteIt (__in_bcount (foo) char* buffer, __in size_t length)
-
Montag, 3. Dezember 2012 10:28
are you guys going to fix this? When I have seen this I did not believe my eyes, copy-pasted the snippet to VS 2012, and you know what -- no analyzer warnings!!!
this doesn't cause any warnings either
void OverwriteIt (_Out_cap_(length) char* buffer, size_t length)
{
memset(buffer, 0, length + 2);
}Shame.

