mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 06:32:10 +02:00
Pass correct buffer length to parseDebugInfo() so as to avoid reading invalid Dwarf tag entry.
This commit is contained in:
parent
9b82edcc56
commit
cbcc62f9c4
2 changed files with 9 additions and 11 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue