diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2019-03-19 01:13:46 +0000 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2019-03-19 01:13:46 +0000 |
commit | 6decb49237b3179e251c9ead2cd31ac8b8ea9adc (patch) | |
tree | fe508ef095e38b4ffa1d76b095c475e19e89d3a4 | |
parent | d565ed0ffbc224f0795f03df011db0fff093c903 (diff) | |
download | mdk-6decb49237b3179e251c9ead2cd31ac8b8ea9adc.tar.gz mdk-6decb49237b3179e251c9ead2cd31ac8b8ea9adc.tar.bz2 |
Fix: allow access to last mem cell in devices (#9773)
Author: Kevin Brunelle
-rw-r--r-- | mixlib/xmix_vm.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mixlib/xmix_vm.c b/mixlib/xmix_vm.c index cf20ee1..68a8106 100644 --- a/mixlib/xmix_vm.c +++ b/mixlib/xmix_vm.c @@ -1,7 +1,7 @@ /* ---------------------- xmix_vm.c : * Implementation of the functions declared in xmix_vm.h * ------------------------------------------------------------------ - * Copyright (C) 2000, 2003, 2004, 2007, 2010, 2013 Free Software Foundation, Inc. + * Copyright (C) 2000, 2003, 2004, 2007, 2010, 2013, 2019 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -333,7 +333,7 @@ inp_handler_ (mix_vm_t *vm, const mix_ins_t *ins) dev = get_dev_ (vm, ins->fspec); fail_if_not_ (vm, dev != NULL, MIX_VM_ERROR_BAD_DEVICE_NO); - fail_if_not_ (vm, MEM_CELLS_NO_ - addr > mix_device_block_size (dev), + fail_if_not_ (vm, MEM_CELLS_NO_ - addr >= mix_device_block_size (dev), MIX_VM_ERROR_BAD_ACCESS); fail_if_not_ (vm, mix_device_read (dev, get_cell_ptr_ (vm, addr)), @@ -359,7 +359,7 @@ out_handler_ (mix_vm_t *vm, const mix_ins_t *ins) dev = get_dev_ (vm, ins->fspec); fail_if_not_ (vm, dev != NULL, MIX_VM_ERROR_BAD_DEVICE_NO); - fail_if_not_ (vm, MEM_CELLS_NO_ - addr > mix_device_block_size (dev), + fail_if_not_ (vm, MEM_CELLS_NO_ - addr >= mix_device_block_size (dev), MIX_VM_ERROR_BAD_ACCESS); fail_if_not_ (vm, mix_device_write (dev, get_cell_ptr_ (vm, addr)), |