New issue 75 by Orgi...@gmail.com: Error decompressing byte array via
ByteCodeType.fromByteArray
http://code.google.com/p/as3-commons/issues/detail?id=75
What steps will reproduce the problem?
1. Use ByteCodeType.fromByteArray(ba, ApplicationDomain.currentDomain);
where ba is the byte array for a swf ( as included in the
example :[Embed(source="someswf.swf", mimeType="application/octet-stream")]
private var swfInput:Class;
function parseSWF():void {
var ba:ByteArray = new swfInput() as ByteArray;
ByteCodeType.fromByteArray(ba, ApplicationDomain.currentDomain);
})
What is the expected output? What do you see instead?
I was expecting some sort of information, but instead I got this error:
Exception fault: Error: Error #2058: There was an error decompressing the
data.
at flash.utils::ByteArray/_uncompress()
at flash.utils::ByteArray/uncompress()
at
org.as3commons.bytecode.reflect::ReflectionDeserializer/read()[C:\projects\as3-commons\as3-commons-bytecode\src\main\actionscript\org\as3commons\bytecode\reflect\ReflectionDeserializer.as:83]
at
org.as3commons.bytecode.reflect::ByteCodeTypeProvider/fromByteArray()[C:\projects\as3-commons\as3-commons-bytecode\src\main\actionscript\org\as3commons\bytecode\reflect\ByteCodeTypeProvider.as:119]
at
org.as3commons.bytecode.reflect::ByteCodeType$/fromByteArray()[C:\projects\as3-commons\as3-commons-bytecode\src\main\actionscript\org\as3commons\bytecode\reflect\ByteCodeType.as:149]
at inspect::C()[/Users/george/Documents/fdt/PointTest/src/inspect/C.as:16]
What version of the product are you using? On what operating system?
as3commons-bytecode-1.0-RC5.swc
as3commons-lang-0.3.5-SNAPSHOT.swc
as3commons-logging-2.5.2.swc
as3commons-reflect-1.4.2.swc
Flash Player 11.0.0.60 (Incubator build) on osx 10.6.8
Please provide any additional information below.
This is the first time I use the library, so not sure what to expect in
this case.
I have however printed some ABC related data via:
var io:SWFFileIO = new SWFFileIO();
var swfFile:SWFFile = io.read(ba);
var abcTags:Array = swfFile.getTagsByType(DoABCTag);
for each(var tag:DoABCTag in abcTags) trace(tag.abcFile);
Any other options for reflection ?
Thank you for your time,
George
I see you're using flashplayer 11, did you compile this SWF with these new
compression settings perhaps?
I've switched SDKs in test project and tried Flex 3.6 with Flash Player 10
and Flex 4.1 with Flash Player 10.1 (compiling both B.as and C.as) and got
the exact same error.
So far I've used FDT 4.5.3.1358 and there was a default option ticked on
project to use Apparat for optimizations. I've unticked the option,
thinking Apparat might compress data in way that isn't compatible with
as3-commons-bytecode, but had no luck.
Switched to Flash Builder 3 (Flex 3.2) and Flash Player 10 and still no
luck (got the same error).
Am I missing something ? Should I add some sort of compiler flag to avoid
compression ?
Thanks for the help,
George
Still no joy with the fromByteArray method, but fromLoader work fine:
var ba:ByteArray = new swfInput() as ByteArray;
l = addChild(new Loader()) as Loader;
l.loadBytes(ba);
ByteCodeType.fromLoader(l.contentLoaderInfo);
l.contentLoaderInfo.addEventListener(Event.COMPLETE,lready);
A bit off topic: Is is possible to get the body of a method as a human
readable value ?
Hey there,
I guess the problem is with parsing an embedded SWF then. I'll try to look
into it.
As for your question 'Is is possible to get the body of a method as a human
readable value'. What I suspect is that you would like to convert the
opcodes back to actionscript source code.
This is technically possible, but it would mean writing a full-blown
actionscript based de-compiler, which is a task that I am not prepared to
undertake, I'm sorry :)
cheers,
Roland
Hello,
Thank you for taking you time to look into this. It's good that I have the
other option so it's not an urgent matter.
Regarding actionscript code, I imagine it's not a simple task. I did manage
to get my head around the bytecode by reading the documentation
(http://learn.adobe.com/wiki/display/AVM2/5.+AVM2+instructions) ...so
yeah..sorry, just me being lazy (clear case of RTFM :) )
I imagine the ByteCodeType.fromByteArray will get attention at some point,
so thank you in advance.
All the best,
George