Fix section_size_inflated parsing.

This commit is contained in:
orboditilt 2019-02-25 12:12:57 +01:00
parent b7fc04ce27
commit 65918d9174
3 changed files with 5 additions and 6 deletions

View File

@ -5,7 +5,7 @@
<groupId>de.orb</groupId>
<artifactId>rpxparser</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.2-SNAPSHOT</version>
<packaging>jar</packaging>
<name>rpxparser</name>
@ -19,7 +19,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
<version>1.18.6</version>
</dependency>
</dependencies>

View File

@ -140,8 +140,7 @@ public class ElfSection {
buf.get(data, 0, (int) orgSize);
if ((flags & RPX_SHDR_ZLIB_FLAG) == RPX_SHDR_ZLIB_FLAG) {
long section_size_inflated = buf.getInt(0) & 0xFFFFFFFF;
long section_size_inflated = buf.getInt((int) offset) & 0xFFFFFFFF;
Inflater inflater = new Inflater();
inflater.setInput(data, 4, (int) orgSize - 4); // the first byte is the size

View File

@ -48,7 +48,7 @@ public class RPXFile {
.collect(Collectors.collectingAndThen( //
Collectors.groupingBy(RPLImport::getRplName, Collectors.toList()), // Group by RPLName
Collections::unmodifiableMap));
}
}
public Optional<byte[]> getFunctionData(ElfSymbol symbol) {
return symbol.section().flatMap(section -> getFunctionData(section, symbol.value() - section.address(), (int) symbol.size()));