Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Ryall2006-06-06 03:28:37 +0000
committerKen Ryall2006-06-06 03:28:37 +0000
commitcbcc62f9c4fb83a36016f37f160b70bbbd92c2b3 (patch)
tree513d668c57aa6cc8f778700a6e177da4b91b55a6
parent9b82edcc564d2e136bcf4b3bcade5c9b63f8c3f3 (diff)
downloadorg.eclipse.cdt-cbcc62f9c4fb83a36016f37f160b70bbbd92c2b3.tar.gz
org.eclipse.cdt-cbcc62f9c4fb83a36016f37f160b70bbbd92c2b3.tar.xz
org.eclipse.cdt-cbcc62f9c4fb83a36016f37f160b70bbbd92c2b3.zip
Pass correct buffer length to parseDebugInfo() so as to avoid reading invalid Dwarf tag entry.
-rw-r--r--core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/Dwarf.java3
-rw-r--r--core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java17
2 files changed, 9 insertions, 11 deletions
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/Dwarf.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/Dwarf.java
index 2b659911dd..003bf174b5 100644
--- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/Dwarf.java
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/Dwarf.java
@@ -348,7 +348,8 @@ public class Dwarf {
}
// read the abbrev section.
- InputStream in = new ByteArrayInputStream(data, offset + 11, length);
+ // Note "length+4" is the total size in bytes of the CU data.
+ InputStream in = new ByteArrayInputStream(data, offset + 11, length+4-11);
Map abbrevs = parseDebugAbbreviation(header);
parseDebugInfoEntry(requestor, in, abbrevs, header);
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java
index 4ae30a7bda..4f445ec317 100644
--- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/debug/dwarf/DwarfReader.java
@@ -171,7 +171,7 @@ public class DwarfReader extends Dwarf implements ISymbolReader {
private void addSourceFile(String dir, String name)
{
- if (name == null)
+ if (name == null || name.length() == 0)
return;
if (name.charAt(0) == '<') // don't count the entry "<internal>" from GCCE compiler
return;
@@ -237,16 +237,13 @@ public class DwarfReader extends Dwarf implements ISymbolReader {
// Override parent: only handle TAG_Compile_Unit.
void processDebugInfoEntry(IDebugEntryRequestor requestor, AbbreviationEntry entry, List list) {
- int len = list.size();
int tag = (int) entry.tag;
- for (int i = 0; i < len; i++) {
- switch (tag) {
- case DwarfConstants.DW_TAG_compile_unit :
- processCompileUnit(requestor, list);
- break;
- default:
- break;
- }
+ switch (tag) {
+ case DwarfConstants.DW_TAG_compile_unit :
+ processCompileUnit(requestor, list);
+ break;
+ default:
+ break;
}
}

Back to the top