From 273173771f2d05f7814fc79ca9eb11de31163851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Wed, 10 Feb 2021 15:24:43 +0100 Subject: [PATCH] Fixed AS3 getslot/setslot in certain situations --- CHANGELOG.md | 1 + .../flash/abc/avm2/instructions/other/GetSlotIns.java | 4 +++- .../flash/abc/avm2/instructions/other/SetSlotIns.java | 9 ++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9399201ec..dc002c776 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. ### Fixed - AS1/2 script export to single file maintains script order - #1088 ECMA Number to string conversion +- AS3 getslot/setslot in certain situations ## [13.0.1] - 2021-02-09 ### Fixed diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java index e8a295338..2056ab528 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java @@ -45,7 +45,9 @@ public class GetSlotIns extends InstructionDefinition { GraphTargetItem obj = objinreg.getThroughRegister(); Reference realObj = new Reference<>(null); Multiname slotname = InstructionDefinition.searchSlotName(slotIndex, localData, obj, realObj); - obj = realObj.getVal(); + if (realObj.getVal() != null) { + obj = realObj.getVal(); + } stack.push(new GetSlotAVM2Item(ins, localData.lineStartInstruction, obj, objinreg, slotIndex, slotname)); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java index 402eb921d..adab26d4a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java @@ -70,10 +70,13 @@ public class SetSlotIns extends InstructionDefinition implements SetTypeIns { GraphTargetItem objnoreg = obj; obj = obj.getThroughRegister(); - Reference realObj = new Reference<>(null); - Multiname slotname = InstructionDefinition.searchSlotName(slotIndex, localData, obj, realObj); + Reference realObjRef = new Reference<>(null); + Multiname slotname = InstructionDefinition.searchSlotName(slotIndex, localData, obj, realObjRef); - obj = realObj.getVal(); + GraphTargetItem realObj = realObjRef.getVal(); + if (realObj != null) { + obj = realObj; + } if (slotname != null) { if (value instanceof LocalRegAVM2Item) {