Resolve segmentation fault issue when trying to copy to outside UDVM LEFT-RIGH bounds.

==> NOW we only return a NACKINFO message and the mobile do not crash.
This commit is contained in:
bossiel 2010-02-03 12:01:53 +00:00
parent 6df2768653
commit eb233ff0a4
2 changed files with 3 additions and 2 deletions

View File

@ -47,7 +47,8 @@ From UDVM to UDVM
int tcomp_udvm_bytecopy_self(tcomp_udvm_t *udvm, uint16_t *destination, uint16_t source, uint16_t size_tocopy)
{
uint16_t byte_copy_left, byte_copy_right;
if (*destination == TCOMP_UDVM_GET_SIZE() || source == TCOMP_UDVM_GET_SIZE())
//if (*destination == TCOMP_UDVM_GET_SIZE() || source == TCOMP_UDVM_GET_SIZE())
if (*destination >= TCOMP_UDVM_GET_SIZE() || source >= TCOMP_UDVM_GET_SIZE())
{
/* SEGFAULT */
tcomp_udvm_createNackInfo2(udvm, NACK_SEGFAULT);

View File

@ -109,7 +109,7 @@ uint16_t tcomp_udvm_opget_reference_param(tcomp_udvm_t *udvm)
case 0x80: // 10nnnnnn nnnnnnnn memory[2 * N] 0 - 65535
{
uint8_t N = (TSK_BINARY_GET_2BYTES(memory_ptr) & 0x3fff);
uint16_t N = (TSK_BINARY_GET_2BYTES(memory_ptr) & 0x3fff);
result = 2*N;
udvm->executionPointer+=2;
}