From 2a3811cc30c3f20c4334f95f7b8bd5aa05d46032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Fri, 5 Feb 2021 19:30:08 +0100 Subject: [PATCH] Fixed #735 AS3 - index out of bounds in deobfuscator --- CHANGELOG.md | 1 + .../deobfuscation/AVM2DeobfuscatorZeroJumpsNullPushes.java | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84e475115..b9759aa41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,7 @@ All notable changes to this project will be documented in this file. - AS3 code with exception start/end not matching instruction boundary - AS3 deobfuscator in some cases - #349 AS3 - better handling of declarations +- #735 AS3 - index out of bounds in deobfuscator ### Changed - AS3 test methods separated to classes diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorZeroJumpsNullPushes.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorZeroJumpsNullPushes.java index 4cc535dcf..630fbcf2a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorZeroJumpsNullPushes.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorZeroJumpsNullPushes.java @@ -83,8 +83,11 @@ public class AVM2DeobfuscatorZeroJumpsNullPushes extends SWFDecompilerAdapter { boolean result = false; Set offsets = code.getImportantOffsets(body, true); - // Deliberately skip over instruction zero - for (int i = 1; i < code.code.size(); i++) { + for (int i = 0; i < code.code.size(); i++) { + if (i == 0) { + // Deliberately skip over instruction zero + continue; + } AVM2Instruction ins1 = code.code.get(i - 1); AVM2Instruction ins2 = code.code.get(i); if (ins2.definition instanceof PopIns