Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2004-01-13 15:32:54 -0500
committerAlain Magloire2004-01-13 15:32:54 -0500
commit9372319dd3f5150992893728bf74e28bb2b78d1f (patch)
tree2ef836e235a86182e2163a676c78689a56fd1cc5
parentc1d289e14d321f3ae46d5e7502730f784a338546 (diff)
downloadorg.eclipse.cdt-9372319dd3f5150992893728bf74e28bb2b78d1f.tar.gz
org.eclipse.cdt-9372319dd3f5150992893728bf74e28bb2b78d1f.tar.xz
org.eclipse.cdt-9372319dd3f5150992893728bf74e28bb2b78d1f.zip
We have to check the range of the st_shndx field
before using it some values are reserved.
-rw-r--r--core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/elf/ElfHelper.java39
1 files changed, 24 insertions, 15 deletions
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