This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix for invalid sanitization of trailing byte in __builtin_strlen


On Fri, Jun 20, 2014 at 02:49:12PM +0400, Maxim Ostapenko wrote:
> This patch fixes invalid sanitization of trailing byte in __builtin_strlen (
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61547).
> 
> Tested on x86_64-unknown-linux-gnu, no regressions.
> +
> +#include <sanitizer/asan_interface.h>
> +
> +char a[2] = "0";
> +
> +#ifdef __cplusplus
> +extern "C"
> +#endif
> +__SIZE_TYPE__ strlen (const char *p) {
> +  /* Simulate error */
> +  if (p == a)
> +    return 1;

Why this?  Can't you instead just use __attribute__((no_sanitize_address, noinline))
on it instead?

Otherwise looks good to me

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]