Pointer corruption after modifying a string from a passed-in struct, then saving the string elsewhere
Submitted by cli..@..ba.org
Link to original bug (#661041)
Description
Steps to reproduce:
- Compile and run the following program:
/******************************************/ struct SSS { public string ss; }
class CCC { public string cs; public CCC(SSS incoming) { incoming.ss = "test"; this.cs = incoming.ss; } }
void main() { SSS thing1 = SSS(); thing1.ss = "uncorrupted string"; CCC thing2 = new CCC(thing1); } /******************************************/
...and observe the results.
Notice that a crash occurs, usually with the following error in the console: *** glibc detected *** ./testcase3: double free or corruption (fasttop): 0x(address) ***
Note: the code compiles and runs without crashing when using valac-0.12.
Version: 0.14.x