#1241 File content is different to what FFDEC shows in HEX view near instructions

This commit is contained in:
honfika@gmail.com
2016-05-29 12:32:50 +02:00
parent 81c3df016d
commit db0d490fc9
5 changed files with 29 additions and 1 deletions

View File

@@ -2586,6 +2586,7 @@ public final class SWF implements SWFContainerItem, Timelined {
int version = swf == null ? SWF.DEFAULT_VERSION : swf.version;
ActionList list = ActionListReader.readActionListTimeout(listeners, rri, version, prevLength, prevLength + actionBytes.getLength(), src.toString()/*FIXME?*/, deobfuscationMode);
list.fileData = actionBytes.getArray();
list.deobfuscationMode = deobfuscationMode;
if (swf != null) {
swf.as2PcodeCache.put(src, list);

View File

@@ -528,6 +528,7 @@ public abstract class Action implements GraphSourceItem {
offset = address;
int pos = 0;
boolean lastPush = false;
byte[] fileData = list.fileData;
for (Action a : list) {
informListeners(listeners, pos, list.size());
@@ -537,7 +538,21 @@ public abstract class Action implements GraphSourceItem {
lastPush = false;
}
writer.appendNoHilight("; ");
writer.appendNoHilight(Helper.bytesToHexString(a.getBytes(version)));
byte[] bytes = a.getBytes(version);
writer.appendNoHilight(Helper.bytesToHexString(bytes));
long fileOffset = a.getFileOffset();
if (fileData != null && fileOffset != -1 && fileData.length > fileOffset + bytes.length - 1) {
writer.appendNoHilight(" (");
for (int i = 0; i < bytes.length; i++) {
writer.appendNoHilight(Helper.byteToHex(fileData[(int) (fileOffset + i)]));
writer.appendNoHilight(" ");
}
writer.appendNoHilight("@");
writer.appendNoHilight(Helper.formatHex(a.getFileOffset(), 8));
writer.appendNoHilight(")");
}
writer.newLine();
}

View File

@@ -46,6 +46,8 @@ public class ActionList extends ArrayList<Action> {
public int deobfuscationMode;
public byte[] fileData;
public ActionList() {
}

View File

@@ -172,6 +172,7 @@ public class ActionListReader {
getContainerLastActions(actions, containerLastActions);
ActionList ret = new ActionList();
ret.fileData = actions.fileData;
if (nextOffsets != null) {
int index = 0;

View File

@@ -397,6 +397,15 @@ public class Helper {
return sb.toString();
}
public static String formatHex(long value, int width) {
StringBuilder sb = new StringBuilder();
sb.append(Long.toHexString(value));
if (width > sb.length()) {
sb.insert(0, ZEROS8, 0, width - sb.length());
}
return sb.toString();
}
public static String formatInt(int value, int width) {
StringBuilder sb = new StringBuilder();
sb.append(value);