about summary refs log tree commit diff stats
path: root/013direct_addressing.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-02-05 10:33:28 -0800
committerKartik Agaram <vc@akkartik.com>2020-02-05 14:57:52 -0800
commit9ee351f37fbf78aa408f60c0d2c7ec49e625f109 (patch)
treeed55ef4c9cfcbedefda64767164855b576748c75 /013direct_addressing.cc
parentb9d666eff51659a62dab7b746e5ae40431127e9b (diff)
downloadmu-9ee351f37fbf78aa408f60c0d2c7ec49e625f109.tar.gz
5983 - fix an emulator bounds-check bug
It was possible for an instruction to write out of bounds of the memory
data structure. Most of the time this worked fine. However if the block
ever got resized and moved the out-of-bounds bytes no longer went along.
Diffstat (limited to '013direct_addressing.cc')
-rw-r--r--013direct_addressing.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/013direct_addressing.cc b/013direct_addressing.cc
index 38e00665..729b4d08 100644
--- a/013direct_addressing.cc
+++ b/013direct_addressing.cc
@@ -986,7 +986,7 @@ case 0x89: {  // copy r32 to r/m32
   const uint8_t rsrc = (modrm>>3)&0x7;
   trace(Callstack_depth+1, "run") << "copy " << rname(rsrc) << " to r/m32" << end();
   int32_t* dest = effective_address(modrm);
-  *dest = Reg[rsrc].i;
+  *dest = Reg[rsrc].i;  // Write multiple elements of vector<uint8_t> at once. Assumes sizeof(int) == 4 on the host as well.
   trace(Callstack_depth+1, "run") << "storing 0x" << HEXWORD << *dest << end();
   break;
 }