Fixed: [#2394] Broken deobfuscation on incorrect length of ActionStrictMode

Fixed: [#2394] ActionStrictMode with mode larger than 1 now ignored
This commit is contained in:
Jindra Petřík
2025-01-17 20:58:03 +01:00
parent c62cbdddff
commit fc553adb98
3 changed files with 10 additions and 3 deletions

View File

@@ -1942,7 +1942,7 @@ public class SWFInputStream implements AutoCloseable {
case 0x2D:
return new ActionFSCommand2(getCharset());
case 0x89:
return new ActionStrictMode(this);
return new ActionStrictMode(actionLength, this);
// SWF3 Actions
case 0x81:
return new ActionGotoFrame(actionLength, this);

View File

@@ -57,11 +57,12 @@ public class ActionStrictMode extends Action {
/**
* Constructor
* @param actionLength Action length
* @param sis SWF input stream
* @throws IOException On I/O error
*/
public ActionStrictMode(SWFInputStream sis) throws IOException {
super(0x89, 1, sis.getCharset());
public ActionStrictMode(int actionLength, SWFInputStream sis) throws IOException {
super(0x89, actionLength, sis.getCharset());
mode = sis.readUI8("mode");
}
@@ -104,6 +105,9 @@ public class ActionStrictMode extends Action {
@Override
public void translate(Map<String, Map<String, Trait>> uninitializedClassTraits, SecondPassData secondPassData, boolean insideDoInitAction, GraphSourceItem lineStartItem, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
if (mode != 1) {
return;
}
output.add(new StrictModeActionItem(this, lineStartItem, mode));
}
}