From c1a5d32c871de6b85960aa914276401e5fdbf87a Mon Sep 17 00:00:00 2001 From: Joerg Wunsch Date: Wed, 18 Apr 2012 16:00:21 +0000 Subject: [PATCH] * fileio.c (elf2b): When checking the bounds of the current program header segment, subtract `low' from ph[n].p_paddr in order to correct the magic section offsets for the AVR's non-flash memory regions. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1080 81a1dc3b-b13d-400b-aceb-764788c761c2 --- ChangeLog | 7 +++++++ fileio.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 65a04946..a5b93d12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2012-04-18 Joerg Wunsch + + * fileio.c (elf2b): When checking the bounds of the current + program header segment, subtract `low' from ph[n].p_paddr in order + to correct the magic section offsets for the AVR's non-flash + memory regions. + 2012-04-18 Joerg Wunsch * fileio.c (elf_get_scn): Rather than trying to just match whether diff --git a/fileio.c b/fileio.c index 0f859f19..f625543e 100644 --- a/fileio.c +++ b/fileio.c @@ -948,7 +948,7 @@ static int elf2b(char * infile, FILE * inf, * from it, using the "foff" offset obtained above. */ if (mem->size != 1 && - ph[i].p_paddr + ph[i].p_filesz > mem->size) { + ph[i].p_paddr - low + ph[i].p_filesz > mem->size) { fprintf(stderr, "%s: ERROR: program header entry #%d does not fit into \"%s\" memory:\n" " 0x%x + %u > %u\n",