From 65918d91744358ec52b0ba74c3549346f1d93466 Mon Sep 17 00:00:00 2001 From: orboditilt <45944072+orboditilt@users.noreply.github.com> Date: Mon, 25 Feb 2019 12:12:57 +0100 Subject: [PATCH] Fix section_size_inflated parsing. --- pom.xml | 4 ++-- src/main/java/de/orb/wiiu/rpxparser/ElfSection.java | 5 ++--- src/main/java/de/orb/wiiu/rpxparser/RPXFile.java | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 8e6e15d..9bb288f 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ de.orb rpxparser - 0.0.1-SNAPSHOT + 0.0.2-SNAPSHOT jar rpxparser @@ -19,7 +19,7 @@ org.projectlombok lombok - 1.18.4 + 1.18.6 diff --git a/src/main/java/de/orb/wiiu/rpxparser/ElfSection.java b/src/main/java/de/orb/wiiu/rpxparser/ElfSection.java index 5a9fea8..55d1adf 100644 --- a/src/main/java/de/orb/wiiu/rpxparser/ElfSection.java +++ b/src/main/java/de/orb/wiiu/rpxparser/ElfSection.java @@ -79,7 +79,7 @@ public class ElfSection { } public String name() { - // we can be sure the strtab is NOT null. + // we can be sure the strtab is NOT null. return reader.strtab.string(nameIndex); } @@ -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 diff --git a/src/main/java/de/orb/wiiu/rpxparser/RPXFile.java b/src/main/java/de/orb/wiiu/rpxparser/RPXFile.java index 5d56cef..94de135 100644 --- a/src/main/java/de/orb/wiiu/rpxparser/RPXFile.java +++ b/src/main/java/de/orb/wiiu/rpxparser/RPXFile.java @@ -48,7 +48,7 @@ public class RPXFile { .collect(Collectors.collectingAndThen( // Collectors.groupingBy(RPLImport::getRplName, Collectors.toList()), // Group by RPLName Collections::unmodifiableMap)); - } + } public Optional getFunctionData(ElfSymbol symbol) { return symbol.section().flatMap(section -> getFunctionData(section, symbol.value() - section.address(), (int) symbol.size()));