candy-lang / candy

🍭 A sweet, functional programming language that is robust, minimalistic, and expressive.
MIT License
313 stars 3 forks source link

Use after free when printing heap objects #1014

Open styrix560 opened 2 months ago

styrix560 commented 2 months ago

When trying to print objects on the heap in Heap::drop as described in #947, a use after free occurs.

To reproduce, add println!("{:?}", self.objects); in Heap::drop, before self.clear() and execute the following command: cargo r --release -- run packages/Examples/fibonacci.candy -- 10