locked
Prefast not detecting SAL errors RRS feed

  • Question

  • 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.

    Wednesday, September 7, 2011 3:29 PM

All replies

  • May 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.

    Thursday, September 8, 2011 8:06 AM
  • 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)

     

    Thursday, September 8, 2011 8:36 AM
  • 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.

    Monday, December 3, 2012 10:28 AM