Skip to content

Commit 74b08a1

Browse files
author
Wang Jiazi
committed
segment fault may be triggered if the arguments passed to "printf" are different with the tyep specified
in format string
1 parent 8fe7551 commit 74b08a1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Linux/CallStandard/printf_test.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <stdio.h>
2+
3+
int main()
4+
{
5+
const char* pStr = "Test";
6+
long long int d=0x1357135790ABCDEF;
7+
//long long int d=0x1234567887654321;
8+
9+
printf("%llx-%x-%x\n",d, d, d);
10+
printf("%lld-%d-%d\n",d, d, d);
11+
printf("%lld-%d-%d-%d--%s\n", d, d, d, d, pStr);
12+
}

0 commit comments

Comments
 (0)