berry-lang / berry

A ultra-lightweight embedded scripting language optimized for microcontrollers.
https://berry-lang.github.io
MIT License
782 stars 95 forks source link

fix: Crash when overwriting builtin with walrus operator (fixes #416) #418

Closed alufers closed 2 months ago

alufers commented 2 months ago

It appears that check_newvar was called with &e1, but then new_var was mistakenly called with e, which caused the parser to generate garbage opcodes, leading to crashes.

Added test case to verify this behavior.

s-hadinger commented 2 months ago

Wow, you nailed it. I'm impressed because it was hard to find. I cross-checked with Tasmota bytecode compilation and it does not introduce any regression.

Awesome job!