Commit f87c0ca090b1227bc3940b9381e9736114547c3c
authorMichel Pollet <buserror@gmail.com>
Wed, 27 Nov 2013 16:50:46 +0000 (16:50 +0000)
committerMichel Pollet <buserror@gmail.com>
Wed, 27 Nov 2013 16:50:46 +0000 (16:50 +0000)
From bsekisser@github

Signed-off-by: Michel Pollet <buserror@gmail.com>
simavr/sim/sim_avr.c

index 6ece88d84790d60710ac1e3e0c9bd91a7fa6aab3..894bc0bb89f742b10a4797d434ef18c2c9495ae5 100644 (file)
@@ -177,7 +177,7 @@ void avr_set_console_register(avr_t * avr, avr_io_addr_t addr)
 
 void avr_loadcode(avr_t * avr, uint8_t * code, uint32_t size, avr_flashaddr_t address)
 {
-       if (size > avr->flashend+1) {
+       if ((address + size) > avr->flashend+1) {
                AVR_LOG(avr, LOG_ERROR, "avr_loadcode(): Attempted to load code of size %d but flash size is only %d.\n",
                        size, avr->flashend + 1);
                abort();