Debian Codegraph @

test/testfiles_for_unittests/note_after_gnu_property/main.c

raw
1 #include <link.h>
2
3 // NOTE: This is a minimal test fixture that creates an ELF file with a note
4 // segment that has a single NOTE segment with a NT_GNU_PROPERTY_TYPE_0,
5 // followed by a custom note. It's used in a regression test for a buffer
6 // overrun bug in the parsing of the NT_GNU_PROPERTY_TYPE_0.
7
8 struct elf_note {
9 ElfW(Nhdr) nhdr; // header: 12 bytes
10 char name[4]; // name buffer: 2 bytes + 2 bytes padding
11 uint8_t data[8]; // data buffer: 8 bytes
12 };
13
14 __attribute__((section(".note.custom"), aligned(8)))
15 __attribute__((used))
16 const struct elf_note note = {
17 .nhdr = {
18 .n_namesz = 4,
19 .n_descsz = 8,
20 .n_type = 0,
21 },
22 .name = {'H', 'i', '\0'},
23 .data = {},
24 };
25
26 int main() {
27 return 0;
28 }