By comparing stack traces under ld-linux.so and not, I was able to determine
that the NULL is coming from global->errors, which is supposed to get
initialized to STDERR but somehow isn't when ld-linux.so runs curl.
While playing with that, I noticed that trying to printf the address of global
causes a segfault, too. Here's a minimal test case for that, which
replaces src/tool_main.c in curl's source tree.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
FILE *global=0;
printf("STARTED\n");
printf("GLOBAL %p\n", global);
}
joey@kite:~/tmp/curl-7.44.0/debian/build>./src/.libs/curl
STARTED
GLOBAL (nil)
joey@kite:~/tmp/curl-7.44.0/debian/build>/lib64/ld-linux-x86-64.so.2 ./src/.libs/curl
STARTED
Segmentation fault
(Building this same code manually, not in curl's source tree, I have not been
able to reproduce the problem. Something about how it's linked as part of
curl is contributing.)
Here's an even more minimal and strange test case!
joey@kite:~/tmp/curl-7.44.0/debian/build>cat src/tool_main.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
fprintf(stdout, "HELLO\n");
}
joey@kite:~/tmp/curl-7.44.0/debian/build>./src/.libs/curl
HELLO
joey@kite:~/tmp/curl-7.44.0/debian/build>/lib64/ld-linux-x86-64.so.2 ./src/.libs/curl
Segmentation fault
--
see shy jo
Attachment:
signature.asc
Description: Digital signature