lcov exclusions

This commit is contained in:
Frank Denis 2014-09-16 10:52:42 -07:00
parent 7cf7f0a31c
commit 671ee78ce2

View File

@ -287,7 +287,7 @@ _out_of_bounds(void)
raise(SIGKILL); raise(SIGKILL);
#endif #endif
abort(); abort();
} } /* LCOV_EXCL_LINE */
static __attribute__((malloc)) unsigned char * static __attribute__((malloc)) unsigned char *
_alloc_aligned(const size_t size) _alloc_aligned(const size_t size)
@ -297,11 +297,11 @@ _alloc_aligned(const size_t size)
#ifdef MAP_ANON #ifdef MAP_ANON
if ((ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, if ((ptr = mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_PRIVATE | MAP_NOCORE, -1, 0)) == MAP_FAILED) { MAP_ANON | MAP_PRIVATE | MAP_NOCORE, -1, 0)) == MAP_FAILED) {
ptr = NULL; ptr = NULL; /* LCOV_EXCL_LINE */
} }
#elif defined(HAVE_POSIX_MEMALIGN) #elif defined(HAVE_POSIX_MEMALIGN)
if (posix_memalign(&ptr, page_size, size) != 0) { if (posix_memalign(&ptr, page_size, size) != 0) {
ptr = NULL; ptr = NULL; /* LCOV_EXCL_LINE */
} }
#elif defined(_WIN32) #elif defined(_WIN32)
ptr = VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); ptr = VirtualAlloc(NULL, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
@ -338,7 +338,7 @@ _unprotected_ptr_from_user_ptr(const void *ptr)
page_mask = page_size - 1U; page_mask = page_size - 1U;
unprotected_ptr_u = ((uintptr_t) canary_ptr & (uintptr_t) ~page_mask); unprotected_ptr_u = ((uintptr_t) canary_ptr & (uintptr_t) ~page_mask);
if (unprotected_ptr_u <= page_size * 2U) { if (unprotected_ptr_u <= page_size * 2U) {
abort(); abort(); /* LCOV_EXCL_LINE */
} }
return (unsigned char *) unprotected_ptr_u; return (unsigned char *) unprotected_ptr_u;
} }
@ -366,7 +366,7 @@ _sodium_malloc(const size_t size)
unprotected_size = _page_round(size_with_canary); unprotected_size = _page_round(size_with_canary);
total_size = page_size + page_size + unprotected_size + page_size; total_size = page_size + page_size + unprotected_size + page_size;
if ((base_ptr = _alloc_aligned(total_size)) == NULL) { if ((base_ptr = _alloc_aligned(total_size)) == NULL) {
return NULL; return NULL; /* LCOV_EXCL_LINE */
} }
unprotected_ptr = base_ptr + page_size * 2U; unprotected_ptr = base_ptr + page_size * 2U;
_mprotect_noaccess(base_ptr + page_size, page_size); _mprotect_noaccess(base_ptr + page_size, page_size);
@ -393,7 +393,7 @@ sodium_malloc(const size_t size)
void *ptr; void *ptr;
if ((ptr = _sodium_malloc(size)) == NULL) { if ((ptr = _sodium_malloc(size)) == NULL) {
return NULL; return NULL; /* LCOV_EXCL_LINE */
} }
memset(ptr, (int) GARBAGE_VALUE, size); memset(ptr, (int) GARBAGE_VALUE, size);