rpms/elfutils/devel elfutils-0.108-robustify.patch, 1.3, 1.4 elfutils.spec, 1.31, 1.32
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Fri Jun 10 00:42:28 UTC 2005
- Previous message (by thread): rpms/selinux-policy-strict/devel policy-20050606.patch, 1.3, 1.4 selinux-policy-strict.spec, 1.320, 1.321 selinux.csh, 1.1, 1.2 selinux.sh, 1.1, 1.2
- Next message (by thread): rpms/gaim/devel gaim-1.3.1-PIE.patch, NONE, 1.1 .cvsignore, 1.30, 1.31 gaim-desktop.patch, 1.11, 1.12 gaim-fedora-prefs.xml, 1.6, 1.7 gaim.spec, 1.86, 1.87 sources, 1.30, 1.31 gaim-1.1.0-PIE.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: roland
Update of /cvs/dist/rpms/elfutils/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv25989
Modified Files:
elfutils-0.108-robustify.patch elfutils.spec
Log Message:
eu-readelf robustification
elfutils-0.108-robustify.patch:
elfutils-0.108/libelf/elf32_getphdr.c | 10 +++
elfutils-0.108/libelf/elf32_getshdr.c | 15 +++-
elfutils-0.108/libelf/elf32_newphdr.c | 8 ++
elfutils-0.108/libelf/elf32_updatefile.c | 7 ++
elfutils-0.108/libelf/elf_begin.c | 78 +++++++++++++++++------
elfutils-0.108/libelf/elf_getarsym.c | 3
elfutils-0.108/libelf/elf_getshstrndx.c | 44 +++++++++++--
elfutils-0.108/libelf/elf_newscn.c | 18 +++--
elfutils-0.108/libelf/gelf_getdyn.c | 8 +-
elfutils-0.108/libelf/gelf_getlib.c | 5 -
elfutils-0.108/libelf/gelf_getmove.c | 5 -
elfutils-0.108/libelf/gelf_getrel.c | 14 +---
elfutils-0.108/libelf/gelf_getrela.c | 14 +---
elfutils-0.108/libelf/gelf_getsym.c | 8 +-
elfutils-0.108/libelf/gelf_getsyminfo.c | 5 -
elfutils-0.108/libelf/gelf_getsymshndx.c | 12 ++-
elfutils-0.108/libelf/gelf_getversym.c | 5 -
elfutils-0.108/libelf/gelf_update_dyn.c | 14 +---
elfutils-0.108/libelf/gelf_update_lib.c | 11 ---
elfutils-0.108/libelf/gelf_update_move.c | 4 -
elfutils-0.108/libelf/gelf_update_rel.c | 14 +---
elfutils-0.108/libelf/gelf_update_rela.c | 14 +---
elfutils-0.108/libelf/gelf_update_sym.c | 14 +---
elfutils-0.108/libelf/gelf_update_syminfo.c | 11 ---
elfutils-0.108/libelf/gelf_update_symshndx.c | 14 +---
elfutils-0.108/libelf/gelf_update_versym.c | 4 -
elfutils-0.108/libelf/libelfP.h | 9 ++
elfutils-0.108/src/elflint.c | 79 +++++++++++++++++------
elfutils/src/readelf.c | 85 +++++++++++++++++--------
elfutils/src/strip.c | 89 +++++++++++++++++----------
30 files changed, 405 insertions(+), 216 deletions(-)
Index: elfutils-0.108-robustify.patch
===================================================================
RCS file: /cvs/dist/rpms/elfutils/devel/elfutils-0.108-robustify.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- elfutils-0.108-robustify.patch 9 Jun 2005 22:29:12 -0000 1.3
+++ elfutils-0.108-robustify.patch 10 Jun 2005 00:42:25 -0000 1.4
@@ -1,6 +1,10 @@
+src/
2005-06-09 Roland McGrath <roland at redhat.com>
-src/
+ * readelf.c (handle_dynamic, handle_symtab): Check for bogus sh_link.
+ (handle_verneed, handle_verdef, handle_versym, handle_hash): Likewise.
+ (handle_scngrp): Check for bogus sh_info.
+
* strip.c (handle_elf): Check for bogus values in sh_link, sh_info,
st_shndx, e_shstrndx, and SHT_GROUP or SHT_SYMTAB_SHNDX data.
Don't use assert on input values, instead bail with "illformed" error.
@@ -1549,3 +1553,237 @@
size_t hidx = elf_hash (name) % nbucket;
if (bucket[hidx] == 0)
+--- elfutils/src/readelf.c
++++ elfutils/src/readelf.c
+@@ -947,6 +947,7 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G
+ GElf_Shdr *symshdr;
+ Elf_Data *symdata;
+ GElf_Sym sym_mem;
++ GElf_Sym *sym;
+ size_t cnt;
+ size_t shstrndx;
+
+@@ -966,6 +967,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G
+ error (EXIT_FAILURE, 0,
+ gettext ("cannot get section header string table index"));
+
++ sym = gelf_getsym (symdata, shdr->sh_info, &sym_mem);
++
+ grpref = (Elf32_Word *) data->d_buf;
+
+ printf ((grpref[0] & GRP_COMDAT)
+@@ -980,8 +983,8 @@ handle_scngrp (Ebl *ebl, Elf_Scn *scn, G
+ data->d_size / sizeof (Elf32_Word) - 1),
+ elf_ndxscn (scn),
+ elf_strptr (ebl->elf, shstrndx, shdr->sh_name),
+- elf_strptr (ebl->elf, symshdr->sh_link,
+- gelf_getsym (symdata, shdr->sh_info, &sym_mem)->st_name)
++ (sym == NULL ? NULL
++ : elf_strptr (ebl->elf, symshdr->sh_link, sym->st_name))
+ ?: gettext ("<INVALID SYMBOL>"),
+ data->d_size / sizeof (Elf32_Word) - 1);
+
+@@ -1135,7 +1138,8 @@ static void
+ handle_dynamic (Ebl *ebl, Elf_Scn *scn, GElf_Shdr *shdr)
+ {
+ int class = gelf_getclass (ebl->elf);
+- GElf_Shdr glink;
++ GElf_Shdr glink_mem;
++ GElf_Shdr *glink;
+ Elf_Data *data;
+ size_t cnt;
+ size_t shstrndx;
+@@ -1150,6 +1154,11 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn,
+ error (EXIT_FAILURE, 0,
+ gettext ("cannot get section header string table index"));
+
++ glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), &glink_mem);
++ if (glink == NULL)
++ error (EXIT_FAILURE, 0, gettext ("invalid sh_link value in section %Zu"),
++ elf_ndxscn (scn));
++
+ printf (ngettext ("\
+ \nDynamic segment contains %lu entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
+ "\
+@@ -1159,9 +1168,7 @@ handle_dynamic (Ebl *ebl, Elf_Scn *scn,
+ class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
+ shdr->sh_offset,
+ (int) shdr->sh_link,
+- elf_strptr (ebl->elf, shstrndx,
+- gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
+- &glink)->sh_name));
++ elf_strptr (ebl->elf, shstrndx, glink->sh_name));
+ fputs_unlocked (gettext (" Type Value\n"), stdout);
+
+ for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt)
+@@ -1656,7 +1663,8 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G
+ unsigned int cnt;
+ Elf32_Word verneed_stridx = 0;
+ Elf32_Word verdef_stridx = 0;
+- GElf_Shdr glink;
++ GElf_Shdr glink_mem;
++ GElf_Shdr *glink;
+ size_t shstrndx;
+
+ /* Get the data of the section. */
+@@ -1701,6 +1709,11 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G
+ error (EXIT_FAILURE, 0,
+ gettext ("cannot get section header string table index"));
+
++ glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), &glink_mem);
++ if (glink == NULL)
++ error (EXIT_FAILURE, 0, gettext ("invalid sh_link value in section %Zu"),
++ elf_ndxscn (scn));
++
+ /* Now we can compute the number of entries in the section. */
+ nsyms = data->d_size / (class == ELFCLASS32
+ ? sizeof (Elf32_Sym) : sizeof (Elf64_Sym));
+@@ -1715,9 +1728,7 @@ handle_symtab (Ebl *ebl, Elf_Scn *scn, G
+ shdr->sh_info),
+ (unsigned long int) shdr->sh_info,
+ (unsigned int) shdr->sh_link,
+- elf_strptr (ebl->elf, shstrndx,
+- gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
+- &glink)->sh_name));
++ elf_strptr (ebl->elf, shstrndx, glink->sh_name));
+
+ fputs_unlocked (class == ELFCLASS32
+ ? gettext ("\
+@@ -1945,7 +1956,8 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn,
+ {
+ Elf_Data *data;
+ int class = gelf_getclass (ebl->elf);
+- GElf_Shdr glink;
++ GElf_Shdr glink_mem;
++ GElf_Shdr *glink;
+ int cnt;
+ unsigned int offset;
+ size_t shstrndx;
+@@ -1960,6 +1972,11 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn,
+ error (EXIT_FAILURE, 0,
+ gettext ("cannot get section header string table index"));
+
++ glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), &glink_mem);
++ if (glink == NULL)
++ error (EXIT_FAILURE, 0, gettext ("invalid sh_link value in section %Zu"),
++ elf_ndxscn (scn));
++
+ printf (ngettext ("\
+ \nVersion needs section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
+ "\
+@@ -1970,9 +1987,7 @@ handle_verneed (Ebl *ebl, Elf_Scn *scn,
+ class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
+ shdr->sh_offset,
+ (unsigned int) shdr->sh_link,
+- elf_strptr (ebl->elf, shstrndx,
+- gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
+- &glink)->sh_name));
++ elf_strptr (ebl->elf, shstrndx, glink->sh_name));
+
+ offset = 0;
+ for (cnt = shdr->sh_info; --cnt >= 0; )
+@@ -2022,7 +2037,8 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G
+ {
+ Elf_Data *data;
+ int class = gelf_getclass (ebl->elf);
+- GElf_Shdr glink;
++ GElf_Shdr glink_mem;
++ GElf_Shdr *glink;
+ int cnt;
+ unsigned int offset;
+ size_t shstrndx;
+@@ -2037,6 +2053,11 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G
+ error (EXIT_FAILURE, 0,
+ gettext ("cannot get section header string table index"));
+
++ glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), &glink_mem);
++ if (glink == NULL)
++ error (EXIT_FAILURE, 0, gettext ("invalid sh_link value in section %Zu"),
++ elf_ndxscn (scn));
++
+ printf (ngettext ("\
+ \nVersion definition section [%2u] '%s' contains %d entry:\n Addr: %#0*" PRIx64 " Offset: %#08" PRIx64 " Link to section: [%2u] '%s'\n",
+ "\
+@@ -2048,9 +2069,7 @@ handle_verdef (Ebl *ebl, Elf_Scn *scn, G
+ class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
+ shdr->sh_offset,
+ (unsigned int) shdr->sh_link,
+- elf_strptr (ebl->elf, shstrndx,
+- gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
+- &glink)->sh_name));
++ elf_strptr (ebl->elf, shstrndx, glink->sh_name));
+
+ offset = 0;
+ for (cnt = shdr->sh_info; --cnt >= 0; )
+@@ -2106,7 +2125,8 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G
+ Elf_Data *data;
+ int class = gelf_getclass (ebl->elf);
+ Elf_Scn *verscn;
+- GElf_Shdr glink;
++ GElf_Shdr glink_mem;
++ GElf_Shdr *glink;
+ Elf_Scn *defscn;
+ Elf_Scn *needscn;
+ const char **vername;
+@@ -2125,6 +2145,11 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G
+ error (EXIT_FAILURE, 0,
+ gettext ("cannot get section header string table index"));
+
++ glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link), &glink_mem);
++ if (glink == NULL)
++ error (EXIT_FAILURE, 0, gettext ("invalid sh_link value in section %Zu"),
++ elf_ndxscn (scn));
++
+ /* We have to find the version definition section and extract the
+ version names. */
+ defscn = NULL;
+@@ -2347,9 +2372,7 @@ handle_versym (Ebl *ebl, Elf_Scn *scn, G
+ class == ELFCLASS32 ? 10 : 18, shdr->sh_addr,
+ shdr->sh_offset,
+ (unsigned int) shdr->sh_link,
+- elf_strptr (ebl->elf, shstrndx,
+- gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
+- &glink)->sh_name));
++ elf_strptr (ebl->elf, shstrndx, glink->sh_name));
+
+ /* Now we can finally look at the actual contents of this section. */
+ for (cnt = 0; cnt < shdr->sh_size / shdr->sh_entsize; ++cnt)
+@@ -2425,7 +2448,8 @@ handle_hash (Ebl *ebl)
+ Elf32_Word maxlength = 0;
+ Elf32_Word nsyms = 0;
+ uint64_t nzero_counts = 0;
+- GElf_Shdr glink;
++ GElf_Shdr glink_mem;
++ GElf_Shdr *glink;
+
+ if (data == NULL)
+ {
+@@ -2434,6 +2458,16 @@ handle_hash (Ebl *ebl)
+ continue;
+ }
+
++
++ glink = gelf_getshdr (elf_getscn (ebl->elf, shdr->sh_link),
++ &glink_mem);
++ if (glink == NULL)
++ {
++ error (0, 0, gettext ("invalid sh_link value in section %Zu"),
++ elf_ndxscn (scn));
++ continue;
++ }
++
+ nbucket = ((Elf32_Word *) data->d_buf)[0];
+ nchain = ((Elf32_Word *) data->d_buf)[1];
+ bucket = &((Elf32_Word *) data->d_buf)[2];
+@@ -2451,10 +2485,7 @@ handle_hash (Ebl *ebl)
+ shdr->sh_addr,
+ shdr->sh_offset,
+ (unsigned int) shdr->sh_link,
+- elf_strptr (ebl->elf, shstrndx,
+- gelf_getshdr (elf_getscn (ebl->elf,
+- shdr->sh_link),
+- &glink)->sh_name));
++ elf_strptr (ebl->elf, shstrndx, glink->sh_name));
+
+ lengths = (uint32_t *) xcalloc (nbucket, sizeof (uint32_t));
+
Index: elfutils.spec
===================================================================
RCS file: /cvs/dist/rpms/elfutils/devel/elfutils.spec,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- elfutils.spec 9 Jun 2005 22:29:12 -0000 1.31
+++ elfutils.spec 10 Jun 2005 00:42:25 -0000 1.32
@@ -1,5 +1,5 @@
%define version 0.108
-%define release 4
+%define release 5
%define gpl 0
%if %{?_with_compat:1}%{!?_with_compat:0}
@@ -223,8 +223,8 @@
%{_libdir}/libelf.so
%changelog
-* Thu Jun 9 2005 Roland McGrath <roland at redhat.com> - 0.108-4
-- eu-strip robustification
+* Thu Jun 9 2005 Roland McGrath <roland at redhat.com> - 0.108-5
+- robustification of eu-strip and eu-readelf
* Wed May 25 2005 Roland McGrath <roland at redhat.com> - 0.108-3
- more robustification
- Previous message (by thread): rpms/selinux-policy-strict/devel policy-20050606.patch, 1.3, 1.4 selinux-policy-strict.spec, 1.320, 1.321 selinux.csh, 1.1, 1.2 selinux.sh, 1.1, 1.2
- Next message (by thread): rpms/gaim/devel gaim-1.3.1-PIE.patch, NONE, 1.1 .cvsignore, 1.30, 1.31 gaim-desktop.patch, 1.11, 1.12 gaim-fedora-prefs.xml, 1.6, 1.7 gaim.spec, 1.86, 1.87 sources, 1.30, 1.31 gaim-1.1.0-PIE.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-cvs-commits
mailing list