If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler
NEW : We have got a new blog where we post some interesting SWF internals info.
List of issues#1726 P-code to AS3 issue with continue before break
Author: moecazzell
Date created:
Type: bug
Visibility: Everybody read only
Assigned to:
Labels: AS3Decompilation
State: closed
The following function compiles fine to P-code. But when the resulting P-code is
decompiled, that produces AS3 with incorrect logic. Classes with this code structure which
are decompiled, and modified elsewhere and then recompiled, will encounter issues in logic
dependent on this structure.
Below is a simple test function to illustrate the de-compilation issue with resulting
continue and break structure in p-code. The function return value is irrelevant for this
case.
private function test() : int
{
var i:int = 0;
var result:int = -2;
var testgt:int = -1;
while(i < 3)
{
if(0 - i > testgt)
{
result = testgt;
i++;
continue;
}
result = i;
break;
}
return result;
}
Compiled pcode has the same logic.
trait method QName(PrivateNamespace(":TestCase"),"test")
dispid 0
method
name "TestCase/private:test"
returns QName(PackageNamespace(""),"int")
body
maxstack 2
localcount 4
initscopedepth 13
maxscopedepth 14
code
getlocal0
pushscope
debug 1, "i", 0, 1144
debug 1, "result", 1, 1145
debug 1, "testgt", 2, 1146
pushbyte 0
setlocal1
pushbyte -2
setlocal2
pushbyte -1
setlocal3
jump ofs003c
ofs0024:
label
pushbyte 0
getlocal1
subtract
getlocal3
ifngt ofs0036
getlocal3
setlocal2
inclocal_i 1
jump ofs003c
ofs0036:
getlocal1
setlocal2
jump ofs0043
ofs003c:
getlocal1
pushbyte 3
iflt ofs0024
ofs0043:
getlocal2
returnvalue
end ; code
end ; body
end ; method
end ; trait
Decompiled p-code has fundamentally different logic missing the break.
private function test() : int
{
var i:int = 0;
var result:* = -2;
var testgt:int = -1;
while(i < 3)
{
if(0 - i <= testgt)
{
result = i;
// missing a break here which would be synonymous logic
}
result = testgt;
i++;
}
return result;
}
This is fixed in nightly 1945.
State: new→upgraded
State: upgraded→closed