From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:ELF (Executable and Linkable Format)" |
|---|
| claim | "When a file has 0xFF00 (SHN_LORESERVE) or more sections, e_shnum is 0 and the count is in sh_size of section header 0, and if the string-table index is 0xFF00 or more, e_shstrndx is 0xFFFF (SHN_XINDEX) and the index is in sh_link of section 0. When it has 0xFFFF or more program headers, e_phnum is 0xFFFF (PN_XNUM) and the count is in sh_info of section 0." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:ELF (Executable and Linkable Format)" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "e_shnum == 0 with e_shoff != 0; e_shstrndx == 0xFFFF; e_phnum == 0xFFFF" |
|---|
| effect | "read the real values from section header 0: sh_size (section count), sh_link (shstrndx), sh_info (segment count)" |
|---|
| samples | | url | "https://github.com/eliben/pyelftools/raw/5a04389392e25d8128e1acb59828a0a85be791b1/test/testfiles_for_readelf/many_sections.o.elf" |
|---|
| sha256 | "a7005397e8f3be9fc421e664a60b24434320cd9f1cdcbaea0aec4dee47cfadfb" |
|---|
| note | "x86-64 ET_REL: e_shnum 0, e_shstrndx 0xFFFF; section 0 gives 65287 sections and .shstrtab at index 65286" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "num_sections (e_shnum == 0 -> section 0 sh_size), num_segments (e_phnum >= 0xffff -> section 0 sh_info), get_shstrndx (SHN_XINDEX -> section 0 sh_link), quoting the gABI and the x86-64 psABI" |
|---|
| repo | "https://github.com/eliben/pyelftools" |
|---|
| commit | "5a04389392e25d8128e1acb59828a0a85be791b1" |
|---|
| path | "elftools/elf/elffile.py" |
|---|
| lines | "150-167, 230-245, 636-648" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "elfinfo.py on many_sections.o.elf reads 65287 section headers, the last ones .comment, .note.GNU-stack and .shstrtab (index 65286), and resolves all names" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Extended section and segment numbering" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T13:27:39.205Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T07:28:13.938Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read pyelftools elftools/elf/elffile.py num_sections, num_segments and get_shstrndx (lines 145-170, 228-246, 630-650) at 5a04389." |
|---|
|
|
|---|