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


_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to