Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2004-01-13 15:50:06 -0500
committerAlain Magloire2004-01-13 15:50:06 -0500
commit04ea9e6ee11a6c6ef7413c79022c4015fdb67ebb (patch)
tree0ee29773445ae676c88fbc54f0b92c7882ccc125
parentd9c8a82d8937c6ce98c93ee183a4f1bdb3e66267 (diff)
downloadorg.eclipse.cdt-04ea9e6ee11a6c6ef7413c79022c4015fdb67ebb.tar.gz
org.eclipse.cdt-04ea9e6ee11a6c6ef7413c79022c4015fdb67ebb.tar.xz
org.eclipse.cdt-04ea9e6ee11a6c6ef7413c79022c4015fdb67ebb.zip
Chech the range of the st_shndx field, some values
are reserved.
-rw-r--r--core/org.eclipse.cdt.core/ChangeLog8
-rw-r--r--core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/ElfHelper.java39
2 files changed, 32 insertions, 15 deletions
diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog
index 8c3186c1107..9af300996d2 100644
--- a/core/org.eclipse.cdt.core/ChangeLog
+++ b/core/org.eclipse.cdt.core/ChangeLog
@@ -1,3 +1,11 @@
+2004-01-13 Alain Magloire
+
+ Small fix on in the elf parser, we have to check for
+ Elf.Symbol.SHN_HIPROC, Elf.Symbol.SHN_LOPROC
+ that the st_shndx field is not is in this range.
+
+ * utils/org/eclipse/cdt/utils/elf/ElfHelper.java
+
2004-1-5 David Inglis
PR 49851
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/ElfHelper.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/ElfHelper.java
index c10ac1157bc..b4d91e7d0e0 100644
--- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/ElfHelper.java
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/ElfHelper.java
@@ -123,10 +123,13 @@ public class ElfHelper {
for (int i = 0; i < dynsyms.length; i++) {
if (dynsyms[i].st_bind() == Elf.Symbol.STB_GLOBAL && dynsyms[i].st_type() == Elf.Symbol.STT_FUNC) {
int idx = dynsyms[i].st_shndx;
- if (idx < 0)
- continue;
- if (sections[idx].sh_type == Elf.Section.SHT_NULL)
+ if (idx < Elf.Symbol.SHN_HIPROC && idx > Elf.Symbol.SHN_LOPROC) {
+ String name = dynsyms[i].toString();
+ if (name != null && name.trim().length() > 0)
+ v.add(dynsyms[i]);
+ } else if (idx >= 0 && sections[idx].sh_type == Elf.Section.SHT_NULL) {
v.add(dynsyms[i]);
+ }
}
}
@@ -144,11 +147,13 @@ public class ElfHelper {
for (int i = 0; i < dynsyms.length; i++) {
if (dynsyms[i].st_bind() == Elf.Symbol.STB_GLOBAL && dynsyms[i].st_type() == Elf.Symbol.STT_OBJECT) {
int idx = dynsyms[i].st_shndx;
- if (idx < 0)
- continue;
-
- if (sections[idx].sh_type == Elf.Section.SHT_NULL)
+ if (idx < Elf.Symbol.SHN_HIPROC && idx > Elf.Symbol.SHN_LOPROC) {
+ String name = dynsyms[i].toString();
+ if (name != null && name.trim().length() > 0)
+ v.add(dynsyms[i]);
+ } else if (idx >= 0 && sections[idx].sh_type == Elf.Section.SHT_NULL) {
v.add(dynsyms[i]);
+ }
}
}
@@ -181,11 +186,13 @@ public class ElfHelper {
for (int i = 0; i < symbols.length; i++) {
if (symbols[i].st_bind() == Elf.Symbol.STB_GLOBAL && symbols[i].st_type() == Elf.Symbol.STT_FUNC) {
int idx = symbols[i].st_shndx;
- if (idx < 0)
- continue;
-
- if (sections[idx].sh_type != Elf.Section.SHT_NULL)
+ if (idx < Elf.Symbol.SHN_HIPROC && idx > Elf.Symbol.SHN_LOPROC) {
+ String name = symbols[i].toString();
+ if (name != null && name.trim().length() > 0)
+ v.add(symbols[i]);
+ } else if (idx >= 0 && sections[idx].sh_type != Elf.Section.SHT_NULL) {
v.add(symbols[i]);
+ }
}
}
@@ -203,11 +210,13 @@ public class ElfHelper {
for (int i = 0; i < symbols.length; i++) {
if (symbols[i].st_bind() == Elf.Symbol.STB_GLOBAL && symbols[i].st_type() == Elf.Symbol.STT_OBJECT) {
int idx = symbols[i].st_shndx;
- if (idx < 0)
- continue;
-
- if (sections[idx].sh_type != Elf.Section.SHT_NULL)
+ if (idx < Elf.Symbol.SHN_HIPROC && idx > Elf.Symbol.SHN_LOPROC) {
+ String name = symbols[i].toString();
+ if (name != null && name.trim().length() > 0)
+ v.add(symbols[i]);
+ } else if (idx >= 0 && sections[idx].sh_type != Elf.Section.SHT_NULL) {
v.add(symbols[i]);
+ }
}
}

Back to the top