History

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}};

grischka committed 17 years ago

Commit 7c3f19c1 parent aa8d22e1 file · +4 −0Browse files

Unified · Split

tcc.c+4−0
@@ -8808,6 +8808,10 @@ static void init_putv(CType *type, Section *sec, unsigned long c, · 8807 unmodified lines
88088808 /* XXX: generate error if incorrect relocation */
88098809 gen_assign_cast(&dtype);
88108810 bt = type->t & VT_BTYPE;
8811+ /* we'll write at most 12 bytes */
8812+ if (c + 12 > sec->data_allocated) {
8813+ section_realloc(sec, c + 12);
8814+ }
88118815 ptr = sec->data + c;
88128816 /* XXX: make code faster ? */
88138817 if (!(type->t & VT_BITFIELD)) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t