Skip to content

Instantly share code, notes, and snippets.

@jedisct1
Created August 26, 2019 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedisct1/b6d889545015513c5d42f322e7f5b331 to your computer and use it in GitHub Desktop.
Save jedisct1/b6d889545015513c5d42f322e7f5b331 to your computer and use it in GitHub Desktop.
Stack alignment bug in Xcode 11 with AVX optimizations
#include <fcntl.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
typedef struct {
char d[16];
void *e;
struct { char b[5536]; } f;
} i;
void g(void) {
struct addrinfo hints, *k;
memset(&hints, 0, sizeof hints);
getaddrinfo(NULL, NULL, &hints, &k);
}
int main(void) {
puts("Hello world");
fflush(stdout);
close(open("/dev/null", O_RDONLY));
i context;
context.e = open;
printf("%p\n", context.d);
g();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment