if visual studio 2017 community is generating the pattern fill
then compiler option /RTCsu is being used
this also switches on Incremental linking (*.ilk files will be generated)
earlier versions of compiler used /GZ option which if used now will generate a deprecation warning
your code is also not using scanf_s a secure version of vulnerable scanf();
that should also generate a warning
shown below is the warning and pattern filling and alternate /RTC1 or RTCsu suggestion by compiler
your code
:\>type magic.cpp
#include <stdio.h>
int main() {
int number1, number2, sum;
printf("Enter two integers: ");
scanf("%d %d", &number1, &number2);
sum = number1 + number2;
printf("%d + %d = %d", number1, number2, sum);
return 0;
}
:\>dir /b
magic.cpp
compiled with /GZ
:\>cl /Zi /GZ magic.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.16.27035 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9035 : option 'GZ' has been deprecated and will be removed in a future release
cl : Command line warning D9036 : use 'RTC1' instead of 'GZ'
magic.cpp
Microsoft (R) Incremental Linker Version 14.16.27035.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:magic.exe
/debug
magic.obj
disassembly showing pattern filling and other stack checking constructs like RTCCheckESP
:\>cdb -c "uf magic!main;q" magic.exe | awk "/Reading/,/quit/"
0:000> cdb: Reading initial command 'uf magic!main;q'
*** WARNING: Unable to verify checksum for magic.exe
magic!main:
00d37a70 55 push ebp
00d37a71 8bec mov ebp,esp
00d37a73 83ec1c sub esp,1Ch
00d37a76 b8cccccccc mov eax,0CCCCCCCCh <<<<<<<<<<
00d37a7b 8945e4 mov dword ptr [ebp-1Ch],eax
00d37a7e 8945e8 mov dword ptr [ebp-18h],eax
00d37a81 8945ec mov dword ptr [ebp-14h],eax
00d37a84 8945f0 mov dword ptr [ebp-10h],eax
00d37a87 8945f4 mov dword ptr [ebp-0Ch],eax
00d37a8a 8945f8 mov dword ptr [ebp-8],eax
00d37a8d 8945fc mov dword ptr [ebp-4],eax
00d37a90 6850aed900 push offset magic!__xt_z+0x108 (00d9ae50)
00d37a95 e8b799ffff call magic!ILT+1100(_printf) (00d31451)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
00d37ae0 e834b8ffff call magic!ILT+8980(_RTC_CheckStackVars (00d33319) <<<<<<<
00d37ae5 58 pop eax
00d37ae6 5a pop edx
00d37ae7 83c41c add esp,1Ch
00d37aea 3bec cmp ebp,esp
00d37aec e8bbb6ffff call magic!ILT+8615(__RTC_CheckEsp) (00d331ac) <<<<<<<<<<<<
00d37af1 8be5 mov esp,ebp
00d37af3 5d pop ebp
00d37af4 c3 ret
quit: