Merge "FORTIFY_SOURCE: remove memcpy overlap checks"

This commit is contained in:
Nick Kralevich 2012-12-07 10:10:49 -08:00 committed by Gerrit Code Review
commit c8354f501e

View File

@ -91,8 +91,6 @@ extern void __memcpy_dest_size_error()
__attribute__((__error__("memcpy called with size bigger than destination"))); __attribute__((__error__("memcpy called with size bigger than destination")));
extern void __memcpy_src_size_error() extern void __memcpy_src_size_error()
__attribute__((__error__("memcpy called with size bigger than source"))); __attribute__((__error__("memcpy called with size bigger than source")));
extern void __memcpy_overlap_error()
__attribute__((__error__("memcpy called with overlapping regions")));
__BIONIC_FORTIFY_INLINE __BIONIC_FORTIFY_INLINE
void *memcpy (void *dest, const void *src, size_t copy_amount) { void *memcpy (void *dest, const void *src, size_t copy_amount) {
@ -109,11 +107,6 @@ void *memcpy (void *dest, const void *src, size_t copy_amount) {
__memcpy_src_size_error(); __memcpy_src_size_error();
} }
if (__builtin_constant_p(d - s) && __builtin_constant_p(copy_amount)
&& (((size_t)(d - s) < copy_amount) || ((size_t)(s - d) < copy_amount))) {
__memcpy_overlap_error();
}
return __builtin___memcpy_chk(dest, src, copy_amount, d_len); return __builtin___memcpy_chk(dest, src, copy_amount, d_len);
} }