[Top][All Lists]

[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, 25 Oct 2010 20:00:55 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.3

On 10/25/2010 07:58 PM, Paul Eggert wrote:
On 10/25/10 03:09, Paolo Bonzini wrote:

Maybe this could use "func (n, alloca (INT_BUFSIZE_BOUND (t)))" if C99
is not in use?

No, alas, because on some hosts, alloca cannot be used within an
argument to a call.  This is because alloca messes with the stack
pointer at the same time that the compiler is pushing things onto the
stack.  This is documented in gnulib's lib/alloca.in.h.

Ugh, makes sense.

For C89 compilers, possibly we could detect at compile time whether
it's safe to call alloca from within a function's argument.  (Is this
safe in GCC?

I can take a look at the code, it is definitely safe with GCC 4 and -fno-tree-ter.


reply via email to

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