vfs: check userland buffers before reading them.
[haiku.git] / src / tests / system / runtime_loader / test_suite / load_lookup_next1
blobf76374c41495f693d02114ab582172a5579058e4
1 #!/bin/sh
3 # program
4 # <- liba.so
5 # <- libb.so
6 # <- libd.so
8 # Expected: dlsym(RTLD_NEXT) finds symbol in order liba.so, libb.so, libd.so
11 . ./test_setup
14 # create libd.so
15 cat > libd.c << EOI
16 int a() { return 1; }
17 EOI
19 # build
20 compile_lib -o libd.so libd.c
23 # create libb.so
24 cat > libb.c << EOI
25 #define __USE_GNU
26 #include <dlfcn.h>
27 int
28 a()
30 int (*nextA)();
31 *(void**)&nextA = dlsym(RTLD_NEXT, "a");
32 return (nextA != 0 ? nextA() : 0) + 2;
34 EOI
36 # build
37 compile_lib_dl -o libb.so libb.c ./libd.so
40 # create liba.so
41 cat > liba.c << EOI
42 #include <dlfcn.h>
43 int
44 a()
46 int (*nextA)();
47 *(void**)&nextA = dlsym(RTLD_NEXT, "a");
48 return (nextA != 0 ? nextA() : 0) + 4;
50 EOI
52 # build
53 compile_lib_dl -o liba.so liba.c ./libb.so
56 # create program
57 cat > program.c << EOI
59 #include <dlfcn.h>
60 int
61 a()
63 int (*nextA)();
64 *(void**)&nextA = dlsym(RTLD_NEXT, "a");
65 return (nextA != 0 ? nextA() : 0) + 8;
68 int
69 main()
71 return a();
73 EOI
75 # build
76 compile_program_dl -o program program.c ./liba.so
78 # run
79 test_run_ok ./program 15