cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_easy_setopt() typechecker, try2

From: Michal Marek <mmarek_at_suse.cz>
Date: Sun, 02 Mar 2008 15:29:08 +0100

Brian Dessent napsal(a):
> Daniel Stenberg wrote:
>>> The caller may pass a 32-bit value on the stack, and the callee parse a
>>> 64-bit value from the stack, so 32 bits of the value seen in the callee can
>>> be garbage. In this case, if you passed FALSE, the callee might interpret
>>> it as TRUE instead. Not what you want, a real bug.
>> Yes, and it is in fact a bit curious that this hasn't bitten us more. Why is
>> that? Do 64bit archs typically pass on 64bit values on the stack?
>
> On x86_64 Linux, the calling convention is that up to the first six
> arguments that are <= 64 bits are extended to 64 bits and passed in
> registers %rdi, %rsi, %rdx, %rcx, %r8 and %r9 in that order. If all
...
> I don't know about any other 64 bit arches.

IIRC at least ppc64 and s390x linux are similar in that regard. That's
why I was thinking about tolerating int for the options that use long
and perhaps making it stricter later (based on the expectation that if
Joe random programmer all of sudden gets 50 new warnings from libcurl
headers, 47 of those warning about rather academical problems from his
POV, he'll likely ignore them all).

Michal
Received on 2008-03-02