]>
Commit | Line | Data |
---|---|---|
13ba007e A |
1 | // TEST_CRASHES |
2 | /* | |
3 | TEST_RUN_OUTPUT | |
4 | objc\[\d+\]: Memory corruption in class list\. | |
5 | objc\[\d+\]: HALTED | |
6 | END | |
7 | */ | |
8 | ||
9 | #include "test.h" | |
10 | #include "testroot.i" | |
11 | ||
12 | @interface Super : TestRoot @end | |
13 | @implementation Super @end | |
14 | ||
15 | @interface Sub : Super @end | |
16 | @implementation Sub @end | |
17 | ||
18 | int main() | |
19 | { | |
20 | alarm(10); | |
21 | ||
22 | Class supercls = [Super class]; | |
23 | Class subcls = [Sub class]; | |
24 | id subobj __unused = [Sub alloc]; | |
25 | ||
26 | // Create a cycle in a superclass chain (Sub->supercls == Sub) | |
27 | // then attempt to walk that chain. Runtime should halt eventually. | |
28 | _objc_flush_caches(supercls); | |
34d5b5e8 | 29 | ((Class __ptrauth_objc_super_pointer *)(__bridge void *)subcls)[1] = subcls; |
13ba007e A |
30 | #ifdef CACHE_FLUSH |
31 | _objc_flush_caches(supercls); | |
32 | #else | |
33 | [subobj class]; | |
34 | #endif | |
35 | ||
36 | fail("should have crashed"); | |
37 | } |