2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 0 | FileCheck -check-prefix=NOSSP %s
|
2015-06-30 01:29:50 +08:00
|
|
|
// NOSSP: define {{.*}}void @test1(i8* %msg) #0 {
|
2009-12-16 04:14:24 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=WITHSSP %s
|
2015-06-30 01:29:50 +08:00
|
|
|
// WITHSSP: define {{.*}}void @test1(i8* %msg) #0 {
|
2014-02-11 09:35:14 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPSTRONG %s
|
2015-06-30 01:29:50 +08:00
|
|
|
// SSPSTRONG: define {{.*}}void @test1(i8* %msg) #0 {
|
2014-02-11 09:35:14 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 3 | FileCheck -check-prefix=SSPREQ %s
|
2015-06-30 01:29:50 +08:00
|
|
|
// SSPREQ: define {{.*}}void @test1(i8* %msg) #0 {
|
2015-06-16 05:08:13 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=safe-stack | FileCheck -check-prefix=SAFESTACK %s
|
2015-06-30 01:29:50 +08:00
|
|
|
// SAFESTACK: define {{.*}}void @test1(i8* %msg) #0 {
|
2013-02-17 11:06:16 +08:00
|
|
|
|
|
|
|
typedef __SIZE_TYPE__ size_t;
|
2009-06-28 15:36:13 +08:00
|
|
|
|
2009-10-09 07:05:06 +08:00
|
|
|
int printf(const char * _Format, ...);
|
2013-02-17 11:06:16 +08:00
|
|
|
size_t strlen(const char *s);
|
|
|
|
char *strcpy(char *s1, const char *s2);
|
2009-06-28 15:36:13 +08:00
|
|
|
|
|
|
|
void test1(const char *msg) {
|
|
|
|
char a[strlen(msg) + 1];
|
|
|
|
strcpy(a, msg);
|
|
|
|
printf("%s\n", a);
|
|
|
|
}
|
2013-02-20 15:22:19 +08:00
|
|
|
|
2013-02-21 03:30:01 +08:00
|
|
|
// NOSSP: attributes #{{.*}} = { nounwind{{.*}} }
|
2013-02-20 15:22:19 +08:00
|
|
|
|
2013-02-21 03:30:01 +08:00
|
|
|
// WITHSSP: attributes #{{.*}} = { nounwind ssp{{.*}} }
|
2013-02-20 15:22:19 +08:00
|
|
|
|
2014-02-11 09:35:14 +08:00
|
|
|
// SSPSTRONG: attributes #{{.*}} = { nounwind sspstrong{{.*}} }
|
|
|
|
|
2013-02-21 03:30:01 +08:00
|
|
|
// SSPREQ: attributes #{{.*}} = { nounwind sspreq{{.*}} }
|
2015-06-16 05:08:13 +08:00
|
|
|
|
|
|
|
// SAFESTACK: attributes #{{.*}} = { nounwind safestack{{.*}} }
|