Fixed: #2511 Allowing to jump from search window while editation causing problems

Changed: Serial form of AS3 search results changed so the decompiler is unable to read
saved AS3 search result from older versions and vice-versa
This commit is contained in:
Jindra Petřík
2025-08-14 09:23:58 +02:00
parent 33d6f9f300
commit 4dbdc09278
4 changed files with 26 additions and 6 deletions

View File

@@ -66,6 +66,7 @@ All notable changes to this project will be documented in this file.
- [#2507] FLA export - Place characters over multiple button frames
- [#2508] AS1/2 direct editation - first command in for loop header not compiled
- [#2510] AS direct editation - popped value
- [#2511] Allowing to jump from search window while editation causing problems
### Changed
- Icon of "Deobfuscation options" menu from pile of pills to medkit
@@ -78,6 +79,8 @@ All notable changes to this project will be documented in this file.
- The label of option "automatic deobfuscation" changed to "deobfuscate code"
- SetTabIndex tag moved from others to frames folder
- SWF3 actions split into SWF1, SWF2 and SWF3 actions (in FFDec source code, docs, etc.)
- Serial form of AS3 search results changed so the decompiler is unable to read
saved AS3 search result from older versions and vice-versa
### Removed
- Resample wav to 44kHz feature from GUI
@@ -3973,6 +3976,7 @@ Major version of SWF to XML export changed to 2.
[#2507]: https://www.free-decompiler.com/flash/issues/2507
[#2508]: https://www.free-decompiler.com/flash/issues/2508
[#2510]: https://www.free-decompiler.com/flash/issues/2510
[#2511]: https://www.free-decompiler.com/flash/issues/2511
[#2476]: https://www.free-decompiler.com/flash/issues/2476
[#2404]: https://www.free-decompiler.com/flash/issues/2404
[#1418]: https://www.free-decompiler.com/flash/issues/1418

View File

@@ -23,6 +23,7 @@ import com.jpexs.decompiler.flash.abc.ClassPath;
import com.jpexs.decompiler.flash.abc.ScriptPack;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.treeitems.Openable;
import com.jpexs.decompiler.graph.DottedChain;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
@@ -80,7 +81,7 @@ public class ABCSearchResult implements Serializable, ScriptSearchResult {
/**
* Serial version major
*/
private static final int SERIAL_VERSION_MAJOR = 1;
private static final int SERIAL_VERSION_MAJOR = 2;
/**
* Serial version minor
*/
@@ -98,14 +99,27 @@ public class ABCSearchResult implements Serializable, ScriptSearchResult {
ObjectInputStream ois = new ObjectInputStream(is);
int versionMajor = ois.read();
ois.read(); //minor
if (versionMajor == 1) {
throw new IOException("Cannot read older version results");
}
if (versionMajor != SERIAL_VERSION_MAJOR) {
throw new IOException("Unknown search result version: " + versionMajor);
}
SWF swf = null;
if (openable instanceof SWF) {
swf = (SWF) openable;
}
if (openable instanceof ABC) {
swf = ((ABC) openable).getSwf();
}
ClassPath cp;
List<Integer> traitIndices;
try {
cp = (ClassPath) ois.readObject();
String classPathDC = ois.readUTF();
DottedChain dc = DottedChain.parseWithSuffix(classPathDC);
cp = new ClassPath(dc.getWithoutLast(), dc.getLast(), dc.getLastNamespaceSuffix(), swf);
traitIndices = (List<Integer>) ois.readObject();
} catch (ClassNotFoundException ex) {
Logger.getLogger(ABCSearchResult.class.getName()).log(Level.SEVERE, null, ex);
@@ -149,7 +163,7 @@ public class ABCSearchResult implements Serializable, ScriptSearchResult {
ObjectOutputStream oos = new ObjectOutputStream(os);
oos.write(SERIAL_VERSION_MAJOR);
oos.write(SERIAL_VERSION_MINOR);
oos.writeObject(scriptPack.getClassPath());
oos.writeUTF(scriptPack.getClassPath().toRawString());
oos.writeObject(scriptPack.traitIndices);
oos.writeBoolean(pcode);
oos.writeInt(classIndex);

View File

@@ -460,6 +460,9 @@ public class SearchResultsDialog<E extends SearchResult> extends AppDialog {
@SuppressWarnings("unchecked")
private void gotoElement() {
if (Main.getMainFrame().getPanel().checkEdited()) {
return;
}
if (openableToResults.size() > 1) {
BasicTreeNode selection = (BasicTreeNode) resultsTree.getLastSelectedPathComponent();
if (selection.getData() instanceof SearchResult) {

View File

@@ -176,13 +176,12 @@ public class SearchResultsStorage {
if (kind == DATA_ACTION) {
currentResults.add(new ActionSearchResult((SWF) openable, bais));
}
} catch (ScriptNotFoundException | IOException ex) {
ex.printStackTrace();
} catch (ScriptNotFoundException ex) {
//ignore
}
}
} catch (IOException ex) {
Logger.getLogger(SearchResultsStorage.class.getName()).log(Level.SEVERE, null, ex);
//ignore
}
unpackedData.set(j, currentResults);
result.addAll(currentResults);