Skip to content

Fixing Bugs with MARIE.js Explained

Eric Jiang edited this page Sep 10, 2016 · 3 revisions

Synopsis

This page talks about how to go about solving multiple important and critical issues found in MARIE.js

Bug 148 - Memory Cell Overflow Bug

This bug occurs when the user tries to jump to an address beyond the address range of 0 to 4096.

For example, the following code would break the simulator, and crash the webpage.

LoadI X
X, DEC 4097

All we did was check if the values passed to PC is beyond the address range or not:

if(target == "pc"){
   if(this[target] < 0 || this target >= 4096){
      throw new MarieSimError("RuntimeError", ...);
   }
}

from marie.js

Clone this wiki locally