This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[COMMITTED] libelf: getdata check 64bit values correctly on 32bit arch.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Sun, 16 Nov 2014 11:28:50 +0100
- Subject: [COMMITTED] libelf: getdata check 64bit values correctly on 32bit arch.
On 32bit arches size_t is too small to do size and overflow checks
of 64bit ELF files. Use the actual Elf64 types to make sure checks
on 64bit ELF files are done correctly on 32bit arches.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
---
libelf/ChangeLog | 5 +++++
libelf/elf_getdata.c | 6 +++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index 4fbe94c..4886093 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-16 Mark Wielaard <mjw@redhat.com>
+
+ * elf_getdata.c (__libelf_set_rawdata_wrlock): Declare offset, size
+ and align as Elf64_Off and Elf64_Xword not size_t.
+
2014-11-14 Mark Wielaard <mjw@redhat.com>
* gelf_getnote.c (gelf_getnote): Check offset overflow.
diff --git a/libelf/elf_getdata.c b/libelf/elf_getdata.c
index 1ce1e23..0aeb997 100644
--- a/libelf/elf_getdata.c
+++ b/libelf/elf_getdata.c
@@ -170,9 +170,9 @@ int
internal_function
__libelf_set_rawdata_wrlock (Elf_Scn *scn)
{
- size_t offset;
- size_t size;
- size_t align;
+ Elf64_Off offset;
+ Elf64_Xword size;
+ Elf64_Xword align;
int type;
Elf *elf = scn->elf;
--
1.8.3.1