am a6eef3be: Merge "Revert "cdefs.h: add artificial attribute to FORTIFY_SOURCE functions""
				
					
				
			* commit 'a6eef3be105fb34161fd1b1d513f7d03b5f1bbe9': Revert "cdefs.h: add artificial attribute to FORTIFY_SOURCE functions"
This commit is contained in:
		@@ -534,7 +534,7 @@
 | 
				
			|||||||
#endif
 | 
					#endif
 | 
				
			||||||
#define __bos0(s) __builtin_object_size((s), 0)
 | 
					#define __bos0(s) __builtin_object_size((s), 0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define __BIONIC_FORTIFY_INLINE extern __inline__ __always_inline __attribute__((gnu_inline)) __attribute__((__artificial__))
 | 
					#define __BIONIC_FORTIFY_INLINE extern __inline__ __always_inline __attribute__((gnu_inline))
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#define __BIONIC_FORTIFY_UNKNOWN_SIZE ((size_t) -1)
 | 
					#define __BIONIC_FORTIFY_UNKNOWN_SIZE ((size_t) -1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -119,6 +119,17 @@ TEST_F(DEATHTEST, sprintf_fortified2) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef __clang__
 | 
				
			||||||
 | 
					// This test is disabled in clang because clang doesn't properly detect
 | 
				
			||||||
 | 
					// this buffer overflow. TODO: Fix clang.
 | 
				
			||||||
 | 
					TEST_F(DEATHTEST, sprintf2_fortified2) {
 | 
				
			||||||
 | 
					  ::testing::FLAGS_gtest_death_test_style = "threadsafe";
 | 
				
			||||||
 | 
					  foo myfoo;
 | 
				
			||||||
 | 
					  ASSERT_EXIT(sprintf(myfoo.a, "0123456789"),
 | 
				
			||||||
 | 
					              testing::KilledBySignal(SIGABRT), "");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifndef __clang__
 | 
					#ifndef __clang__
 | 
				
			||||||
// These tests are disabled in clang because clang doesn't properly detect
 | 
					// These tests are disabled in clang because clang doesn't properly detect
 | 
				
			||||||
// this buffer overflow. TODO: Fix clang.
 | 
					// this buffer overflow. TODO: Fix clang.
 | 
				
			||||||
@@ -516,6 +527,12 @@ TEST_F(DEATHTEST, sprintf_malloc_fortified) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEST_F(DEATHTEST, sprintf2_fortified) {
 | 
				
			||||||
 | 
					  ::testing::FLAGS_gtest_death_test_style = "threadsafe";
 | 
				
			||||||
 | 
					  char buf[5];
 | 
				
			||||||
 | 
					  ASSERT_EXIT(sprintf(buf, "aaaaa"), testing::KilledBySignal(SIGABRT), "");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int vsprintf_helper(const char *fmt, ...) {
 | 
					static int vsprintf_helper(const char *fmt, ...) {
 | 
				
			||||||
  char buf[10];
 | 
					  char buf[10];
 | 
				
			||||||
  va_list va;
 | 
					  va_list va;
 | 
				
			||||||
@@ -682,6 +699,16 @@ TEST_F(DEATHTEST, FD_ISSET_2_fortified) {
 | 
				
			|||||||
  ASSERT_EXIT(FD_ISSET(0, set), testing::KilledBySignal(SIGABRT), "");
 | 
					  ASSERT_EXIT(FD_ISSET(0, set), testing::KilledBySignal(SIGABRT), "");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// gtest's ASSERT_EXIT needs a valid expression, but glibc has a do-while macro.
 | 
				
			||||||
 | 
					static void FD_ZERO_function(fd_set* s) { FD_ZERO(s); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					TEST_F(DEATHTEST, FD_ZERO_fortified) {
 | 
				
			||||||
 | 
					  ::testing::FLAGS_gtest_death_test_style = "threadsafe";
 | 
				
			||||||
 | 
					  char buf[1];
 | 
				
			||||||
 | 
					  fd_set* set = (fd_set*) buf;
 | 
				
			||||||
 | 
					  ASSERT_EXIT(FD_ZERO_function(set), testing::KilledBySignal(SIGABRT), "");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST_F(DEATHTEST, read_fortified) {
 | 
					TEST_F(DEATHTEST, read_fortified) {
 | 
				
			||||||
  ::testing::FLAGS_gtest_death_test_style = "threadsafe";
 | 
					  ::testing::FLAGS_gtest_death_test_style = "threadsafe";
 | 
				
			||||||
  char buf[1];
 | 
					  char buf[1];
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user