[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
NSInvocation
From: |
David Chisnall |
Subject: |
NSInvocation |
Date: |
Mon, 30 Mar 2009 14:55:37 +0100 |
Hi,
I'm looking at lines 1032--1038 of NSInvocation.m:
struct {
char x[size];
} dummy;
dummy = va_arg(ap, typeof(dummy));
memcpy(datum, dummy.x, size);
This will only work in cases where the arguments are all passed on the
stack, so won't work for structures containing floating point, vector,
or integer arguments where there is still space in the registers, and
will cause stack corruption in the case where this is not what
happens. I am trying to work out why this code exists at all, since
ffi and ffcall contain routines for doing this safely.
My current issue is that this relies on a GCC extension which clang is
never going to support (specifically, variable length structure
members). Is there any reason for this code to exist? Throwing an
exception here seems like more sane behaviour; at least that will
always fail, rather than fail nondeterministically.
David
- NSInvocation,
David Chisnall <=