fix data overflow with init_putv
The simplest code to reproduce this bug seems to be int a[][] = {{1,1,1,1,1,1,1}};
This commit is contained in:
parent
aa8d22e38e
commit
7c3f19c079
1 changed files with 4 additions and 0 deletions
4
tcc.c
4
tcc.c
|
@ -8808,6 +8808,10 @@ static void init_putv(CType *type, Section *sec, unsigned long c,
|
|||
/* XXX: generate error if incorrect relocation */
|
||||
gen_assign_cast(&dtype);
|
||||
bt = type->t & VT_BTYPE;
|
||||
/* we'll write at most 12 bytes */
|
||||
if (c + 12 > sec->data_allocated) {
|
||||
section_realloc(sec, c + 12);
|
||||
}
|
||||
ptr = sec->data + c;
|
||||
/* XXX: make code faster ? */
|
||||
if (!(type->t & VT_BITFIELD)) {
|
||||
|
|
Loading…
Reference in a new issue