Fix a serious memory corruption that happened when using the JTAG ICE
mkII (or AVR Dragon) in ISP mode. The wrong set of per-programmer private data had been allocated (stk500v2 vs. jtagmkII) which was too small to hold the actual data. git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@781 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
parent
a91e8e01b2
commit
21d6738cc8
|
@ -1,3 +1,12 @@
|
||||||
|
2008-10-31 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||||
|
|
||||||
|
* jtagmkII.c: Fix a serious memory corruption that happened when
|
||||||
|
using the JTAG ICE mkII (or AVR Dragon) in ISP mode. The wrong
|
||||||
|
set of per-programmer private data had been allocated (stk500v2
|
||||||
|
vs. jtagmkII) which was too small to hold the actual data.
|
||||||
|
* jtagmkII.h: (Ditto.)
|
||||||
|
* stk500v2.c: (Ditto.)
|
||||||
|
|
||||||
2008-07-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
2008-07-29 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
|
||||||
|
|
||||||
* jtagmkII.c: Implement Xmega JTAG support.
|
* jtagmkII.c: Implement Xmega JTAG support.
|
||||||
|
|
|
@ -130,7 +130,7 @@ static int jtagmkII_setparm(PROGRAMMER * pgm, unsigned char parm,
|
||||||
unsigned char * value);
|
unsigned char * value);
|
||||||
static void jtagmkII_print_parms1(PROGRAMMER * pgm, const char * p);
|
static void jtagmkII_print_parms1(PROGRAMMER * pgm, const char * p);
|
||||||
|
|
||||||
static void jtagmkII_setup(PROGRAMMER * pgm)
|
void jtagmkII_setup(PROGRAMMER * pgm)
|
||||||
{
|
{
|
||||||
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
|
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
@ -141,7 +141,7 @@ static void jtagmkII_setup(PROGRAMMER * pgm)
|
||||||
memset(pgm->cookie, 0, sizeof(struct pdata));
|
memset(pgm->cookie, 0, sizeof(struct pdata));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void jtagmkII_teardown(PROGRAMMER * pgm)
|
void jtagmkII_teardown(PROGRAMMER * pgm)
|
||||||
{
|
{
|
||||||
free(pgm->cookie);
|
free(pgm->cookie);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,14 @@ void jtagmkII_dw_initpgm (PROGRAMMER * pgm);
|
||||||
void jtagmkII_dragon_initpgm (PROGRAMMER * pgm);
|
void jtagmkII_dragon_initpgm (PROGRAMMER * pgm);
|
||||||
void jtagmkII_dragon_dw_initpgm (PROGRAMMER * pgm);
|
void jtagmkII_dragon_dw_initpgm (PROGRAMMER * pgm);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These functions are referenced from stk500v2.c for JTAG ICE mkII
|
||||||
|
* and AVR Dragon programmers running in one of the STK500v2
|
||||||
|
* modi.
|
||||||
|
*/
|
||||||
|
void jtagmkII_setup(PROGRAMMER * pgm);
|
||||||
|
void jtagmkII_teardown(PROGRAMMER * pgm);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
16
stk500v2.c
16
stk500v2.c
|
@ -3482,8 +3482,8 @@ void stk500v2_jtagmkII_initpgm(PROGRAMMER * pgm)
|
||||||
pgm->print_parms = stk500v2_print_parms;
|
pgm->print_parms = stk500v2_print_parms;
|
||||||
pgm->set_sck_period = stk500v2_set_sck_period_mk2;
|
pgm->set_sck_period = stk500v2_set_sck_period_mk2;
|
||||||
pgm->perform_osccal = stk500v2_perform_osccal;
|
pgm->perform_osccal = stk500v2_perform_osccal;
|
||||||
pgm->setup = stk500v2_setup;
|
pgm->setup = jtagmkII_setup;
|
||||||
pgm->teardown = stk500v2_teardown;
|
pgm->teardown = jtagmkII_teardown;
|
||||||
pgm->page_size = 256;
|
pgm->page_size = 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3513,8 +3513,8 @@ void stk500v2_dragon_isp_initpgm(PROGRAMMER * pgm)
|
||||||
pgm->paged_load = stk500v2_paged_load;
|
pgm->paged_load = stk500v2_paged_load;
|
||||||
pgm->print_parms = stk500v2_print_parms;
|
pgm->print_parms = stk500v2_print_parms;
|
||||||
pgm->set_sck_period = stk500v2_set_sck_period_mk2;
|
pgm->set_sck_period = stk500v2_set_sck_period_mk2;
|
||||||
pgm->setup = stk500v2_setup;
|
pgm->setup = jtagmkII_setup;
|
||||||
pgm->teardown = stk500v2_teardown;
|
pgm->teardown = jtagmkII_teardown;
|
||||||
pgm->page_size = 256;
|
pgm->page_size = 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3546,8 +3546,8 @@ void stk500v2_dragon_pp_initpgm(PROGRAMMER * pgm)
|
||||||
pgm->set_varef = stk500v2_set_varef;
|
pgm->set_varef = stk500v2_set_varef;
|
||||||
pgm->set_fosc = stk500v2_set_fosc;
|
pgm->set_fosc = stk500v2_set_fosc;
|
||||||
pgm->set_sck_period = stk500v2_set_sck_period_mk2;
|
pgm->set_sck_period = stk500v2_set_sck_period_mk2;
|
||||||
pgm->setup = stk500v2_setup;
|
pgm->setup = jtagmkII_setup;
|
||||||
pgm->teardown = stk500v2_teardown;
|
pgm->teardown = jtagmkII_teardown;
|
||||||
pgm->page_size = 256;
|
pgm->page_size = 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3579,8 +3579,8 @@ void stk500v2_dragon_hvsp_initpgm(PROGRAMMER * pgm)
|
||||||
pgm->set_varef = stk500v2_set_varef;
|
pgm->set_varef = stk500v2_set_varef;
|
||||||
pgm->set_fosc = stk500v2_set_fosc;
|
pgm->set_fosc = stk500v2_set_fosc;
|
||||||
pgm->set_sck_period = stk500v2_set_sck_period_mk2;
|
pgm->set_sck_period = stk500v2_set_sck_period_mk2;
|
||||||
pgm->setup = stk500v2_setup;
|
pgm->setup = jtagmkII_setup;
|
||||||
pgm->teardown = stk500v2_teardown;
|
pgm->teardown = jtagmkII_teardown;
|
||||||
pgm->page_size = 256;
|
pgm->page_size = 256;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue