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.

#32 ParseException
Author:
googleCode

Date created:
Type: bug
Visibility: Everybody
Assigned to:
Labels: AS1/2Google CodeP-code
State: closed 

There is a problem while parsing an SWF that contains a function which has a jump or if to
the next instruction after it. When function is read from the byte stream a new
'ActionDefineFunction' object created. All sub-actions are placed into 'code' field. But
when you try to retreive raw byte code of such function by calling method 'getBytes' you
get an extra byte FF in the end attached. That's because it's actually doesn't give you an
original code but rather assembles a new stream from these sub-actions. Thus branch
instructions count the instruction next after function (only if they go there) to its boby
length leading to wrong value for 'codeSize' field in the function's byte code.
ActionDefineFunction.java
100 byte codeBytes[] = Action.actionsToBytes(code, false, version);
101 sos.writeUI16(codeBytes.length);
Here it goes to be +1 due to the wrong translation of the list of actions to bytes.
<b>What steps will reproduce the problem?</b>
1. Parse an SWF that contains such a function. Sometimes it goes ok, but you still can see
an exception in the log and a wrong "255" instruction in the P-code.
<b>What is the expected output? What do you see instead?</b>
From log:
??? 21, 2013 10:48:02 AM com.jpexs.decompiler.flash.SWFInputStream readActionList
SEVERE: parsing error
com.jpexs.decompiler.flash.action.parser.ParseException: ParseException:Unknown
instruction name :action255 on line 69
at com.jpexs.decompiler.flash.action.parser.ASMParser.parse(ASMParser.java:250)
at
com.jpexs.decompiler.flash.action.swf7.ActionDefineFunction2.<init>(ActionDefineFunc
tion2.java:119)
at com.jpexs.decompiler.flash.action.parser.ASMParser.parse(ASMParser.java:234)
at com.jpexs.decompiler.flash.action.parser.ASMParser.parse(ASMParser.java:265)
at com.jpexs.decompiler.flash.SWFInputStream.readActionList(SWFInputStream.java:512)
at com.jpexs.decompiler.flash.tags.DoActionTag.getActions(DoActionTag.java:108)
at com.jpexs.decompiler.flash.action.gui.ActionPanel$3.run(ActionPanel.java:216)
<b>What version of the product are you using? On what operating system?</b>
Ffdec 1.3
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>
Here what you get in ASdec 1.2:
Jump loc02a6
loc0291:Push 0.0 "checkPressedButtom"
CallFunction
Pop
Jump loc02a6
loc02a6:
}
loc02a6:SetMember
Push "eventListener"
GetVariable
Push 1 "Key"
GetVariable
Push "addListener"
CallMethod
Pop
And now the same chunk in the FFdec 1.3:
Jump loc02a6
loc0291:Push 0.0 "checkPressedButtom"
CallFunction
Pop
Jump loc02a6
loc02a6:Action255
}
SetMember
Push "eventListener"
GetVariable
Push 1 "Key"
GetVariable
Push "addListener"
CallMethod
<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,
it is fixed in version 1.3.1,
try it again.
State: →closed
Title: ParseException→ParseException
Type: →bug
Visibility: →Everybody
Title: ParseException→ParseException
Type: →bug
Visibility: →Everybody