Navigation Menu

Skip to content

Commit

Permalink
MMU: Fix bounds checks on read.
Browse files Browse the repository at this point in the history
  • Loading branch information
nelhage committed May 28, 2011
1 parent 30214f3 commit 7482542
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion MMU.js
Expand Up @@ -7,7 +7,7 @@ var MMU = {
},
read: function(addr) {
var ea = (addr & ~PC_SUPERVISOR) >> 2;
if (ea >> 2 > MMU.memory.length) {
if (ea > MMU.memory.length) {
throw new Error("Invalid read: " + (addr & ~PC_SUPERVISOR));
}
return MMU.memory[ea];
Expand Down

0 comments on commit 7482542

Please sign in to comment.