magicalhobo / SWFWire

Flash Development Tools

Home Page:http://www.swfwire.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File is broken after Read-Write

DmitriyYukhanov opened this issue · comments

If I'll read and then write (without any changes) using SWF10Writer this file:
http://www.sendspace.com/file/pf9ciq

It will become a significantly smaller and stop start in Flash Player.
Also this file will have a numerous different strange tags added.

commented

@DmitriyYukhanov why not as3swf though? there's advanced fork with abc stuff (and as3commons bytecode in case you don't like forks).

I didn't see the as3swf fork with ABC stuff, thanks, will have a look into it too.
as3commons bytecode is not strong enough too and have it's own issues: http://code.google.com/p/as3-commons/issues/ (reported issues127-132 today)

Well, I've looked at all available as3swf forks and looks like there is no actively developed one, so I'm not sure it'll have any sense to try them.

I see the SWFWire and as3commons are only the options now since both are actively developed and it's possible to get some support from guys making them. I'm still not sure which framework will use in my project, now I'll try to use both in separate branches and see who'll fit in my needs better.

Though both frameworks are not so strong while dealing with defected and hardly obfuscated SWFs comparing to the RABCDasm, but looks like we have no any other options here so I'll be glad to help with making those frameworks more strong reporting all regarding issues I'll encounter.

commented

I was talking specifically about this fork which went far beyond original as3swf - if you check network graph you will see that original as3swf had recently few commits after looooong hiatus. I do not know how does its code compare to as3commons bytecode, however.

Thanks, I howether this repo was updated a half of year ago!( I'm afraid it is abandoned right now...

Anyway, looks like we have a hardore off-topic here, please tweet me if you wish to continue our conversation.
Bug reported here is still actual.

Hey, Sean did you had any success with this bug reproducing?

In fact, I have some more SWFs both obfuscated and not that are broken after Read-Write cycle. Please, let me know if you wish to see all of them.

I'm not sure it fixed this issue =(
Still have this problem with attached file (1001.swf) and some other files as well.

Oops, there was a file missing, so your code probably wasn't compiling. Can you try again?

Nope, I used SWF10Writer to save files...
Should I force SWF13Writer using instead (saving with SWF10Writer still producing broken files)?

Hmm, I've been testing with SWF13Writer, but SWF10Writer works for me too. I updated SWFWire Debugger on the download page if you want to install that and try. I get a 1069kb file.

I see, but I'm using the Decompiler framework directly. This way:
http://pastebin.com/UudmEZYY

Could you please confirm this code works for you? (I still got the 659 KB file that won't run)

Tried SWF13Writer - same results =(
I ensured I used latest GIT revision before trying.

There must be something wrong with compression. I'll check it out but for now, setting swf.header.signature = SWFHeader.SIGNATURE_UNCOMPRESSED should work.

Thanks for your reply, but it's still doesn't help - now it produces FWS file, but it still is not working and have a small size =\

BTW, attached file is FWS by default and it is not being compressed on saving at any of my tests.

Also I got this warnings while reading attached file:

Unknown tag type: 46 (id: 4)
Unknown tag type: 46 (id: 6)
Unknown tag type: 46 (id: 8)
Unknown tag type: 46 (id: 10)
Read underflow for Tag 22 (type: 22). Read 3446 bytes, expected 127373 bytes.
Read underflow for Tag 29 (type: 22). Read 1801 bytes, expected 9956 bytes.
Read underflow for Tag 31 (type: 22). Read 1038 bytes, expected 48456 bytes.
Read underflow for Tag 33 (type: 22). Read 4914 bytes, expected 137775 bytes.
Read underflow for Tag 35 (type: 22). Read 1805 bytes, expected 34801 bytes.

Probably it's a cause of the SWF break after Write.

I found the SWFWriter.writeMatrixRecord produces wrong results.
I tried to replace it with http://pastebin.com/bS0YyfA4 and attached file starts working after this.
Though it has much lesser file size comparing to original (both FWS) (

Closing because the file isn't available anymore, and I'm not sure if the bug still exists.