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.

#43 Ternaty operator decompilation problem
Author:
googleCode

Date created:
Type: bug
Visibility: Everybody
Assigned to:
Labels: AS1/2DecompilationGoogle Code
State: closed 

<b>What steps will reproduce the problem?</b>
1. Decompile the same example from Issue#39.
2. Try to retreive code from DoInitAction tag 68.
3. An error occurs and deompiler is unable to show anything.
<b>What is the expected output? What do you see instead?</b>
The problem occurs while translating a ternary operator from the following function
(actualy this chunk is a result of decompilation of earlier versions of ffdec - 1.2.0u1
and 1.3.1 respectively):
register2.rewind=function(t)
{
this._time=!(t==undefined)?t:0;
this.fixTime();
this.update();
};
function rewind(t)
{
this._time=t!=undefined?t:0;
this.fixTime()
this.update()
}
As I have understood, the top of the stack is not always popped (depends on isCompileTime)
and in some conditions this leads to erroneus stack. Here are some runtime traces that
show the stack population while translating action list into source.
Action is Push register1 constant22 register2 undefined
Stack is []
---------
Action is Equals2
Stack is [register1, "CONSTANT22", register2, undefined]
---------
Action is ActionIf
Stack is [register1, "CONSTANT22", register2==undefined]
---------
Action is Push 0.0
Stack is [register1, "CONSTANT22", register2==undefined]
---------
Action is SetMember
Stack is [register1, "CONSTANT22", register2==undefined, 0] <<<<
---------
Action is Push 0.0 register1 constant61
Stack is [register1]
---------
Action is CallMethod
Stack is [register1, 0, register1, "CONSTANT61"]
---------
Action is Pop
Stack is [register1, register1.CONSTANT61()]
---------
Action is Push 0.0 register1 constant27
Stack is [register1]
---------
Action is CallMethod
Stack is [register1, 0, register1, "CONSTANT27"]
---------
Action is Pop
Stack is [register1, register1.CONSTANT27()]
---------
Action is Push register2
Stack is [register1]
---------
Action is Jump 12
Stack is [register1, register2]
---------
Action is SetMember
Stack is [register1, register2]
---------
Exception in thread "Thread-6" java.util.EmptyStackException
at java.util.Stack.peek(Unknown Source)
at java.util.Stack.pop(Unknown Source)
<b>What version of the product are you using? On what operating system?</b>
1.4.1
Windows 7 64 bit
<b>Could you provide the SWF file you have problem with?</b>
<b>If the answer is yes, then please attach it here or send me it via email.</b>
<b>Could you at least attach PCode source?</b>
<b>Do you have the original source code which produced the wrong</b>
<b>decompilation? If yes, then please attach it.</b>
<b>Please provide any additional information below.</b>
Hi,
this is fixed in version 1.4.2, try it.
State: →closed
Title: Ternaty operator decompilation problem→Ternaty operator decompilation problem
Type: →bug
Visibility: →Everybody
Title: Ternaty operator decompilation problem→Ternaty operator decompilation problem
Type: →bug
Visibility: →Everybody