Fixed #1906 Memory search - byte align opens wrong SWFs

This commit is contained in:
Jindra Petřík
2022-12-23 13:33:52 +01:00
parent b53590210d
commit 2c0eaae1a2
2 changed files with 13 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ All notable changes to this project will be documented in this file.
- [#1858] PDF export - Applying same alpha/blendmode multiple times
- [#1858] PDF export - Applying same color multiple times
- [#1907] Crashing on memory search
- [#1906] Memory search - byte align opens wrong SWFs
### Changed
- Warning before switching deobfuscation is now optional
@@ -2796,6 +2797,7 @@ All notable changes to this project will be documented in this file.
[#595]: https://www.free-decompiler.com/flash/issues/595
[#1908]: https://www.free-decompiler.com/flash/issues/1908
[#1907]: https://www.free-decompiler.com/flash/issues/1907
[#1906]: https://www.free-decompiler.com/flash/issues/1906
[#1898]: https://www.free-decompiler.com/flash/issues/1898
[#1511]: https://www.free-decompiler.com/flash/issues/1511
[#1765]: https://www.free-decompiler.com/flash/issues/1765

View File

@@ -40,7 +40,9 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -90,6 +92,8 @@ public class LoadFromMemoryFrame extends AppFrame {
private DefaultTableModel resTableModel;
private List<Object[]> results = new ArrayList<>();
private Map<Integer, Integer> modelToResultMap = new LinkedHashMap<>();
private final JTable tableRes;
@@ -165,11 +169,17 @@ public class LoadFromMemoryFrame extends AppFrame {
}
resTableModel.setRowCount(0);
modelToResultMap.clear();
int rowNum = 0;
int resultNum = 0;
for (Object[] rowData:results) {
long address = (long) rowData[4];
if (align == 0 || (address % align) == 0) {
modelToResultMap.put(rowNum, resultNum);
resTableModel.addRow(rowData);
rowNum++;
}
resultNum++;
}
}
@@ -193,6 +203,7 @@ public class LoadFromMemoryFrame extends AppFrame {
}
int index = tableRes.getRowSorter().convertRowIndexToModel(tableRes.getSelectedRow());
if (index > -1) {
index = modelToResultMap.get(index);
SwfInMemory swf = foundIs.get(index);
ReReadableInputStream str = swf.is;
try {