segfault
Closed this issue · 2 comments
initbar commented
While playing with lolcode, I've isolated the segfaulting code:
HAI 1.2
I HAS A VAR ITZ 1
VAR R ":{VAR}"
VISIBLE VAR
KTHXBYE
In here, the segfault happens only when VISIBLE VAR
is called. I think the problem is with this line:
VAR R "{:VAR}"
after string interpolation of VAR
and overwriting self.
justinmeza commented
Thanks for finding this!
The interpreter tries to interpolate string lazily, so after the line VAR R ":{VAR}"
is executed, the value of VAR
is ":{VAR}"
. When VAR
is eventually interpolated in VISIBLE VAR
, the interpreter tries to expand it to ":{:{
...:{VAR}
...}}"
and runs out of memory.
To solve this problem, I will patch the interpreter to interpolate assigned strings.
justinmeza commented