mortbopet / Ripes

A graphical processor simulator and assembly editor for the RISC-V ISA
https://ripes.me/
MIT License
2.49k stars 270 forks source link

Add stack-heap collision check to BrkSyscall execution #346

Open federicovilla55 opened 5 months ago

federicovilla55 commented 5 months ago

Implemented additional checking in the execute() method of the brk syscall, defined in the BrkSyscall class, to ensure that memory allocation does not overflow stack space. The System Call has as its argument the new "program break", which is now compared with the current "stack pointer" before being set to avoid overlaps. This commit resolves a @todo present in the code.

mortbopet commented 2 weeks ago

Awesome! And then the obligatory question of - is it possible to add a unit test for this? :)