projects
/
sx
/
simavr.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
regExp
home
|
summary
|
tags
|
heads
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
raw
|
patch
| inline |
side by side
(parent:
b682e4b
)
Commit
2a012a045c4d75bf9cb97ca1d4034a40afefe8c8
author
Sami Liedes
<sliedes@cc.hut.fi>
Sat, 19 Feb 2011 03:25:53 +0000
(
05:25
+0200)
committer
Michel Pollet
<buserror@gmail.com>
Mon, 21 Feb 2011 23:17:38 +0000
(23:17 +0000)
Check that the code to be loaded actually fits in the flash.
Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
simavr/sim/sim_avr.c
patch
|
blob
|
history
|
download
diff --git
a/simavr/sim/sim_avr.c
b/simavr/sim/sim_avr.c
index 80c888bcb8c532dfca22401f1885248a9eaa1cf1..d5611ba4eac4bb6625bcc02de80e36371095b894 100644
(file)
--- a/
simavr/sim/sim_avr.c
+++ b/
simavr/sim/sim_avr.c
@@
-150,6
+150,11
@@
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, uint32_t address)
{
+ if (size > avr->flashend+1) {
+ fprintf(stderr, "avr_loadcode(): Attempted to load code of size %d but flash size is only %d.\n",
+ size, avr->flashend+1);
+ abort();
+ }
memcpy(avr->flash + address, code, size);
}