Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F154295847
D8701.id22727.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D8701.id22727.diff
View Options
Index: contrib/elftoolchain/libelf/libelf_ehdr.c
===================================================================
--- contrib/elftoolchain/libelf/libelf_ehdr.c
+++ contrib/elftoolchain/libelf/libelf_ehdr.c
@@ -170,10 +170,6 @@
(*xlator)((unsigned char*) ehdr, msz, e->e_rawfile, (size_t) 1,
e->e_byteorder != LIBELF_PRIVATE(byteorder));
- /*
- * If extended numbering is being used, read the correct
- * number of sections and program header entries.
- */
if (ec == ELFCLASS32) {
phnum = ((Elf32_Ehdr *) ehdr)->e_phnum;
shnum = ((Elf32_Ehdr *) ehdr)->e_shnum;
@@ -193,12 +189,19 @@
return (NULL);
}
- if (shnum != 0 || shoff == 0LL) { /* not using extended numbering */
+ /*
+ * If extended numbering is being used, read the correct
+ * number of sections and program header entries.
+ */
+ if ((shnum == 0 && shoff != 0) || phnum == PN_XNUM || strndx == SHN_XINDEX) {
+ if (_libelf_load_extended(e, ec, shoff, phnum, strndx) == 0)
+ return (NULL);
+ } else {
+ /* not using extended numbering */
e->e_u.e_elf.e_nphdr = phnum;
e->e_u.e_elf.e_nscn = shnum;
e->e_u.e_elf.e_strndx = strndx;
- } else if (_libelf_load_extended(e, ec, shoff, phnum, strndx) == 0)
- return (NULL);
+ }
return (ehdr);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 28, 4:24 PM (9 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32291253
Default Alt Text
D8701.id22727.diff (1 KB)
Attached To
Mode
D8701: libelf: Fix extended numbering detection
Attached
Detach File
Event Timeline
Log In to Comment