bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] inttostr.h: add compile-time buffer overrun checks


From: Paolo Bonzini
Subject: Re: [PATCH] inttostr.h: add compile-time buffer overrun checks
Date: Mon, 18 Oct 2010 14:48:19 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.3

On 10/18/2010 01:53 PM, Pádraig Brady wrote:
On 17/10/10 20:58, Bruno Haible wrote:
+/* When, on glibc systems, -D_FORTIFY_SOURCE=1 or -D_FORTIFY_SOURCE=2 is used,
+   enable extra bounds checking, based on the object bounds analysis done by
+   GCC.
+   The user can disable this bounds checking by defining _GL_NO_FORTIFY.
+   __attribute__ __warning__ requires GCC>= 4.3.
+   __builtin_object_size requires GCC>= 4.1.
+   __always_inline__ requires GCC>= 3.2.  */
+#if __USE_FORTIFY_LEVEL>  0&&  !defined _GL_NO_FORTIFY&&  __GNUC_PREREQ (4, 3)

How about adding support for older compilers as follows.
This might also be a stepping stone for people trying
to understand the more thorough version?

I don't think it's worthwhile, honestly. Maybe it is worthwhile however to enable the checks for 4.1 with the sole exception of the link-time warning. For 4.1 and 4.2, leave out the aliasing of inttostr_chk_warn so that it remains undefined and linking fails.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]