The em interpreter does not properly handle signed integer division overflow. For example, running the following em code with a word size of 2 currently gives me a floating point exception and stops the interpreter:
loc -32768
loc -1
dvi EM_WSIZE
The issue is in do_intar.c in the private function dvi() there is no check for this condition. As stated in the SEI CMU web site, when the dividend is equal to the minimum (negative) value for the signed integer type and the divisor is equal to −1 this leads to overflow.
The em interpreter does not properly handle signed integer division overflow. For example, running the following em code with a word size of 2 currently gives me a floating point exception and stops the interpreter:
The issue is in do_intar.c in the private function dvi() there is no check for this condition. As stated in the SEI CMU web site, when the dividend is equal to the minimum (negative) value for the signed integer type and the divisor is equal to −1 this leads to overflow.
I will fix this in my next commit.