pyasm2
pyasm2 copied to clipboard
memory addresses with segment
When referencing an address with a segment, e.g. in the following snippet.
mov(eax, dword[fs:eax])
Then, because the python index limit for 32bit versions is MAX_INT which is 1<<31, we have to store the memory address temporarily in a global dictionary, with a random key. The key, an integer, is passed along in __getitem__ so that the MemoryAddress object (e.g. byte, dword, ..) can read the memory address from the global dictionary (and delete it from the dictionary afterwards.)
After the object has been passed, all is well.