Merge "Workaround b/16818336 which fails build under aggressive inlining."
This commit is contained in:
commit
bb91a1b845
@ -94,9 +94,6 @@ extern size_t strxfrm_l(char* __restrict, const char* __restrict, size_t, locale
|
||||
|
||||
#if defined(__BIONIC_FORTIFY)
|
||||
|
||||
__errordecl(__memcpy_dest_size_error, "memcpy: prevented write past end of buffer");
|
||||
__errordecl(__memcpy_src_size_error, "memcpy: prevented read past end of buffer");
|
||||
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
void* memcpy(void* __restrict dest, const void* __restrict src, size_t copy_amount) {
|
||||
char *d = (char *) dest;
|
||||
@ -104,14 +101,6 @@ void* memcpy(void* __restrict dest, const void* __restrict src, size_t copy_amou
|
||||
size_t s_len = __bos0(s);
|
||||
size_t d_len = __bos0(d);
|
||||
|
||||
if (__builtin_constant_p(copy_amount) && (copy_amount > d_len)) {
|
||||
__memcpy_dest_size_error();
|
||||
}
|
||||
|
||||
if (__builtin_constant_p(copy_amount) && (copy_amount > s_len)) {
|
||||
__memcpy_src_size_error();
|
||||
}
|
||||
|
||||
return __builtin___memcpy_chk(dest, src, copy_amount, d_len);
|
||||
}
|
||||
|
||||
@ -130,16 +119,12 @@ char* strcpy(char* __restrict dest, const char* __restrict src) {
|
||||
return __builtin___strcpy_chk(dest, src, __bos(dest));
|
||||
}
|
||||
|
||||
__errordecl(__stpncpy_error, "stpncpy: prevented write past end of buffer");
|
||||
extern char* __stpncpy_chk2(char* __restrict, const char* __restrict, size_t, size_t, size_t);
|
||||
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
char* stpncpy(char* __restrict dest, const char* __restrict src, size_t n) {
|
||||
size_t bos_dest = __bos(dest);
|
||||
size_t bos_src = __bos(src);
|
||||
if (__builtin_constant_p(n) && (n > bos_dest)) {
|
||||
__stpncpy_error();
|
||||
}
|
||||
|
||||
if (bos_src == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
|
||||
return __builtin___stpncpy_chk(dest, src, n, bos_dest);
|
||||
@ -157,16 +142,12 @@ char* stpncpy(char* __restrict dest, const char* __restrict src, size_t n) {
|
||||
return __stpncpy_chk2(dest, src, n, bos_dest, bos_src);
|
||||
}
|
||||
|
||||
__errordecl(__strncpy_error, "strncpy: prevented write past end of buffer");
|
||||
extern char* __strncpy_chk2(char* __restrict, const char* __restrict, size_t, size_t, size_t);
|
||||
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
char* strncpy(char* __restrict dest, const char* __restrict src, size_t n) {
|
||||
size_t bos_dest = __bos(dest);
|
||||
size_t bos_src = __bos(src);
|
||||
if (__builtin_constant_p(n) && (n > bos_dest)) {
|
||||
__strncpy_error();
|
||||
}
|
||||
|
||||
if (bos_src == __BIONIC_FORTIFY_UNKNOWN_SIZE) {
|
||||
return __builtin___strncpy_chk(dest, src, n, bos_dest);
|
||||
@ -201,7 +182,6 @@ void* memset(void *s, int c, size_t n) {
|
||||
|
||||
extern size_t __strlcpy_real(char* __restrict, const char* __restrict, size_t)
|
||||
__asm__(__USER_LABEL_PREFIX__ "strlcpy");
|
||||
__errordecl(__strlcpy_error, "strlcpy: prevented write past end of buffer");
|
||||
extern size_t __strlcpy_chk(char *, const char *, size_t, size_t);
|
||||
|
||||
__BIONIC_FORTIFY_INLINE
|
||||
@ -219,12 +199,6 @@ size_t strlcpy(char* __restrict dest, const char* __restrict src, size_t size) {
|
||||
if (__builtin_constant_p(size) && (size <= bos)) {
|
||||
return __strlcpy_real(dest, src, size);
|
||||
}
|
||||
|
||||
// Compiler can prove, at compile time, that the passed in size
|
||||
// is always > the actual object size. Force a compiler error.
|
||||
if (__builtin_constant_p(size) && (size > bos)) {
|
||||
__strlcpy_error();
|
||||
}
|
||||
#endif /* !defined(__clang__) */
|
||||
|
||||
return __strlcpy_chk(dest, src, size, bos);
|
||||
@ -232,7 +206,6 @@ size_t strlcpy(char* __restrict dest, const char* __restrict src, size_t size) {
|
||||
|
||||
extern size_t __strlcat_real(char* __restrict, const char* __restrict, size_t)
|
||||
__asm__(__USER_LABEL_PREFIX__ "strlcat");
|
||||
__errordecl(__strlcat_error, "strlcat: prevented write past end of buffer");
|
||||
extern size_t __strlcat_chk(char* __restrict, const char* __restrict, size_t, size_t);
|
||||
|
||||
|
||||
@ -251,12 +224,6 @@ size_t strlcat(char* __restrict dest, const char* __restrict src, size_t size) {
|
||||
if (__builtin_constant_p(size) && (size <= bos)) {
|
||||
return __strlcat_real(dest, src, size);
|
||||
}
|
||||
|
||||
// Compiler can prove, at compile time, that the passed in size
|
||||
// is always > the actual object size. Force a compiler error.
|
||||
if (__builtin_constant_p(size) && (size > bos)) {
|
||||
__strlcat_error();
|
||||
}
|
||||
#endif /* !defined(__clang__) */
|
||||
|
||||
return __strlcat_chk(dest, src, size, bos);
|
||||
|
Loading…
x
Reference in New Issue
Block a user