Menu

Cppcheck crash when file referenced in project is missing

anoy.
2024-03-08
2024-03-08
  • anoy.

    anoy. - 2024-03-08

    Cppcheck 2.13.0 crashes with a STATUS_STACK_BUFFER_OVERRUN exception when running on a Visual Studio solution or project if one of the referenced files does not exist.
    Normally the file is created by a pre-build step that isn't executed by Cppcheck.

    Exception Analysis
    *** WARNING: Check Image - Checksum mismatch - Dump: 0x106d34, File: 0x1038b3 - C:\ProgramData\Dbg\sym\ucrtbase.dll\81CF5D89100000\ucrtbase.dll
    
    KEY_VALUES_STRING: 1
    
        Key  : Analysis.CPU.mSec
        Value: 967
    
        Key  : Analysis.Elapsed.mSec
        Value: 978
    
        Key  : Analysis.IO.Other.Mb
        Value: 0
    
        Key  : Analysis.IO.Read.Mb
        Value: 0
    
        Key  : Analysis.IO.Write.Mb
        Value: 0
    
        Key  : Analysis.Init.CPU.mSec
        Value: 421
    
        Key  : Analysis.Init.Elapsed.mSec
        Value: 860970
    
        Key  : Analysis.Memory.CommitPeak.Mb
        Value: 61
    
        Key  : FailFast.Name
        Value: INVALID_ARG
    
        Key  : FailFast.Type
        Value: 5
    
        Key  : Failure.Bucket
        Value: FAIL_FAST_INVALID_ARG_c0000409_ucrtbase.dll!invoke_watson
    
        Key  : Failure.Hash
        Value: {ff968da7-5196-0e9d-7c2c-c6a2c196fc27}
    
        Key  : Timeline.OS.Boot.DeltaSec
        Value: 1491233
    
        Key  : Timeline.Process.Start.DeltaSec
        Value: 860
    
        Key  : WER.OS.Branch
        Value: vb_release
    
        Key  : WER.OS.Version
        Value: 10.0.19041.1
    
        Key  : WER.Process.Version
        Value: 2.13.0.0
    
    
    NTGLOBALFLAG:  70
    
    APPLICATION_VERIFIER_FLAGS:  0
    
    EXCEPTION_RECORD:  (.exr -1)
    ExceptionAddress: 00007ff9d5fe1208 (ucrtbase!invoke_watson+0x0000000000000018)
       ExceptionCode: c0000409 (Security check failure or stack buffer overrun)
      ExceptionFlags: 00000001
    NumberParameters: 1
       Parameter[0]: 0000000000000005
    Subcode: 0x5 FAST_FAIL_INVALID_ARG 
    
    FAULTING_THREAD:  0000126c
    
    PROCESS_NAME:  cppcheck.exe
    
    ERROR_CODE: (NTSTATUS) 0xc0000409 - The system detected an overrun of a stack-based buffer in this application. This overrun could potentially allow a malicious user to gain control of this application.
    
    EXCEPTION_CODE_STR:  c0000409
    
    EXCEPTION_PARAMETER1:  0000000000000005
    
    STACK_TEXT:  
    00000045`cedfc6c0 00007ff9`d5f924b1     : 00000000`00000002 00000045`cedfc930 00000045`cedfdae0 00007ff9`d5f83a81 : ucrtbase!invoke_watson+0x18
    00000045`cedfc6f0 00007ff9`d5f92379     : 00000000`00000000 00007ff9`d5f83496 00000000`00000002 00000045`cedfdae0 : ucrtbase!_invalid_parameter+0x12d
    00000045`cedfc730 00007ff9`d5fc3f46     : 00000000`00000000 0000017a`294aa960 00000000`ffffffff 00000001`00008000 : ucrtbase!invalid_parameter_noinfo+0x9
    00000045`cedfc770 00007ff9`9198bab7     : 00000000`00000000 00007ff9`d5fe54e2 0000017a`2904ef90 00000045`cedfc838 : ucrtbase!fgetc+0x3b4c6
    00000045`cedfc7b0 00007ff9`919891f7     : 00000045`cedfc838 00000000`00000f7c 00000045`cedfdb80 00000000`00000000 : cppcheck_core!simplecpp::Token::nextSkipComments+0xf97
    00000045`cedfc7e0 00007ff9`91979910     : 00007ff9`91ce3338 00007ff9`91ce3338 00000045`cedfdae0 00000000`00000050 : cppcheck_core!simplecpp::getCppStdString+0x1477
    00000045`cedfc810 00007ff9`91bf2fdf     : 00000045`cedfca40 0000017a`2a0a0e30 00000045`cedfdbb0 00000000`00000000 : cppcheck_core!simplecpp::TokenList::TokenList+0x90
    00000045`cedfc880 00007ff9`91bef4a1     : 00000045`cedfdb80 00000045`cedfdae0 0000017a`29063820 0000017a`29063825 : cppcheck_core!CppCheck::checkFile+0xe0f
    00000045`cedfdab0 00007ff6`65776255     : 0000017a`2a0b03c0 0000017a`29063780 00000045`cedfe6f0 0000017a`28ff77a0 : cppcheck_core!CppCheck::check+0x581
    00000045`cedfe600 00007ff6`65771701     : 0000017a`29063fc0 00000045`cedff0d8 00000045`cedffb40 00000045`cedfe674 : cppcheck+0x16255
    00000045`cedfe650 00007ff6`6577147b     : 0000017a`29063fc0 0000017a`29063fc0 00000045`cedff650 00000045`cedffb30 : cppcheck+0x11701
    00000045`cedfe830 00007ff6`65775f0e     : 0000017a`28ff5d30 00000000`00000000 00000000`00000000 00007ff6`65785200 : cppcheck+0x1147b
    00000045`cedffb00 00007ff6`6577b388     : 0000017a`28ff5d30 00000000`00000000 0000017a`28ffd950 00000000`00000000 : cppcheck+0x15f0e
    00000045`cedffb70 00007ff9`d74b7344     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : cppcheck+0x1b388
    00000045`cedffbb0 00007ff9`d89026b1     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : KERNEL32!BaseThreadInitThunk+0x14
    00000045`cedffbe0 00000000`00000000     : 00000000`00000000 00000000`00000000 00000000`00000000 00000000`00000000 : ntdll!RtlUserThreadStart+0x21
    
    
    STACK_COMMAND:  ~0s ; .cxr ; kb
    
    SYMBOL_NAME:  ucrtbase!invoke_watson+18
    
    MODULE_NAME: ucrtbase
    
    IMAGE_NAME:  ucrtbase.dll
    
    FAILURE_BUCKET_ID:  FAIL_FAST_INVALID_ARG_c0000409_ucrtbase.dll!invoke_watson
    
    OS_VERSION:  10.0.19041.1
    
    BUILDLAB_STR:  vb_release
    
    OSPLATFORM_TYPE:  x64
    
    OSNAME:  Windows 10
    
    IMAGE_VERSION:  10.0.19041.3636
    
    FAILURE_ID_HASH:  {ff968da7-5196-0e9d-7c2c-c6a2c196fc27}
    
    Followup:     MachineOwner
    ---------
    


    I've attached a minimal test project which causes the crash.

     
  • CHR

    CHR - 2024-03-08
     
  • Daniel Marjamäki

    This issue has been partially fixed. It crashes with cppcheck-2.13.0

    daniel@laptop:~/240308$ ~/.cppcheck/cppcheck-2.13.0 --project=test-project/test.vcxproj
    Checking test-project/test.cpp Debug|Win32...
    Checking test-project/test.cpp: _WIN32=1;_MSC_VER=1900...
    1/4 files checked 25% done
    Checking test-project/test.cpp Release|Win32...
    Checking test-project/test.cpp: _WIN32=1;_MSC_VER=1900...
    2/4 files checked 50% done
    Checking test-project/missing.cpp Debug|Win32...
    Segmentation fault (core dumped)
    

    Latest Cppcheck generates a error message:

    daniel@laptop:~/240308$ ../cppcheck/cppcheck --project=test-project/test.vcxproj
    Checking test-project/test.cpp Debug|Win32...
    Checking test-project/test.cpp: _WIN32=1;_MSC_VER=1900...
    1/4 files checked 25% done
    Checking test-project/test.cpp Release|Win32...
    Checking test-project/test.cpp: _WIN32=1;_MSC_VER=1900...
    2/4 files checked 50% done
    Checking test-project/missing.cpp Debug|Win32...
    test-project/missing.cpp:1:0: error: File is missing: test-project/missing.cpp [syntaxError]
    
    ^
    3/4 files checked 75% done
    Checking test-project/missing.cpp Release|Win32...
    4/4 files checked 100% done
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.