1 This testcase verifies that a dynamic load reads the importing callframe 2 after the module body ran. 3 4 The module body of chain0 runs the bodies of the modules it imports, 5 which pushes more callframes. When the callframe vector grows, realloc() 6 can move it, and a callframe pointer taken before the load then points 7 into freed memory. 8 9 This test depends on running under a memory checker. 10 11 -- Testcase -- 12 let fn = loadstring('import { value } from "chain0";\nprint(value, "\\n");\n', { 13 raw_mode: true, 14 force_dynlink_list: [ 'chain0' ] 15 }); 16 17 fn(); 18 -- End -- 19 20 -- File chain0.uc -- 21 import { value as v } from "chain1"; 22 export const value = v + 1; 23 -- End -- 24 25 -- File chain1.uc -- 26 import { value as v } from "chain2"; 27 export const value = v + 1; 28 -- End -- 29 30 -- File chain2.uc -- 31 import { value as v } from "chain3"; 32 export const value = v + 1; 33 -- End -- 34 35 -- File chain3.uc -- 36 import { value as v } from "chain4"; 37 export const value = v + 1; 38 -- End -- 39 40 -- File chain4.uc -- 41 import { value as v } from "chain5"; 42 export const value = v + 1; 43 -- End -- 44 45 -- File chain5.uc -- 46 import { value as v } from "chain6"; 47 export const value = v + 1; 48 -- End -- 49 50 -- File chain6.uc -- 51 import { value as v } from "chain7"; 52 export const value = v + 1; 53 -- End -- 54 55 -- File chain7.uc -- 56 import { value as v } from "chain8"; 57 export const value = v + 1; 58 -- End -- 59 60 -- File chain8.uc -- 61 export const value = 0; 62 -- End -- 63 64 -- Args -- 65 -R -L files/ 66 -- End -- 67 68 -- Expect stdout -- 69 8 70 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt