Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F136924917
D10487.id47197.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D10487.id47197.diff
View Options
Index: contrib/elftoolchain/libelf/_libelf.h
===================================================================
--- contrib/elftoolchain/libelf/_libelf.h
+++ contrib/elftoolchain/libelf/_libelf.h
@@ -31,6 +31,8 @@
#include <sys/queue.h>
+#include <stdbool.h>
+
#include "_libelf_config.h"
#include "_elftc.h"
@@ -213,6 +215,7 @@
int (*_libelf_get_translator(Elf_Type _t, int _direction, int _elfclass))
(unsigned char *_dst, size_t dsz, unsigned char *_src,
size_t _cnt, int _byteswap);
+Elf_Data *_libelf_getdata(Elf_Scn *s, Elf_Data *ed, bool updating);
void *_libelf_getphdr(Elf *_e, int _elfclass);
void *_libelf_getshdr(Elf_Scn *_scn, int _elfclass);
void _libelf_init_elf(Elf *_e, Elf_Kind _kind);
Index: contrib/elftoolchain/libelf/elf_data.c
===================================================================
--- contrib/elftoolchain/libelf/elf_data.c
+++ contrib/elftoolchain/libelf/elf_data.c
@@ -27,6 +27,7 @@
#include <assert.h>
#include <errno.h>
#include <libelf.h>
+#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
@@ -35,7 +36,7 @@
ELFTC_VCSID("$Id: elf_data.c 3466 2016-05-11 18:35:44Z emaste $");
Elf_Data *
-elf_getdata(Elf_Scn *s, Elf_Data *ed)
+_libelf_getdata(Elf_Scn *s, Elf_Data *ed, bool updating)
{
Elf *e;
unsigned int sh_type;
@@ -94,7 +95,9 @@
if ((elftype = _libelf_xlate_shtype(sh_type)) < ELF_T_FIRST ||
elftype > ELF_T_LAST || (sh_type != SHT_NOBITS &&
- (sh_offset > e->e_rawsize || sh_size > e->e_rawsize - sh_offset))) {
+ (!updating &&
+ (sh_offset > e->e_rawsize ||
+ sh_size > e->e_rawsize - sh_offset)))) {
LIBELF_SET_ERROR(SECTION, 0);
return (NULL);
}
@@ -165,6 +168,12 @@
return (&d->d_data);
}
+Elf_Data *
+elf_getdata(Elf_Scn *s, Elf_Data *ed)
+{
+ return (_libelf_getdata(s, ed, false));
+}
+
Elf_Data *
elf_newdata(Elf_Scn *s)
{
@@ -254,7 +263,9 @@
}
if (sh_type != SHT_NOBITS &&
- (sh_offset > e->e_rawsize || sh_size > e->e_rawsize - sh_offset)) {
+ (!updating &&
+ (sh_offset > e->e_rawsize ||
+ sh_size > e->e_rawsize - sh_offset))) {
LIBELF_SET_ERROR(SECTION, 0);
return (NULL);
}
Index: contrib/elftoolchain/libelf/elf_update.c
===================================================================
--- contrib/elftoolchain/libelf/elf_update.c
+++ contrib/elftoolchain/libelf/elf_update.c
@@ -182,7 +182,8 @@
* Otherwise, we need to bring in the section's data
* from the underlying ELF object.
*/
- if (e->e_cmd != ELF_C_WRITE && elf_getdata(s, NULL) == NULL)
+ if (e->e_cmd != ELF_C_WRITE &&
+ _libelf_getdata(s, NULL, true) == NULL)
return (0);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 21, 4:51 PM (19 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25778314
Default Alt Text
D10487.id47197.diff (2 KB)
Attached To
Mode
D10487: Bug 218861 - libelf elf_update fails when adding sections
Attached
Detach File
Event Timeline
Log In to Comment