avm2

VerifyError #1023 when trying to modify AVM2 bytecodes


I'm trying to patch the bytecode of a SWF from RABCDasm. Here's my patch:

findpropstrict      QName(PackageNamespace("flash.net"),"URLRequest")
pushstring          "http://www.example.com/fake_proxied_post"
constructprop       QName(PackageNamespace("flash.net"),"URLRequest"), 1
coerce              QName(PackageNamespace("flash.net"),"URLRequest")
setlocal            9
getlocal            9
getlex              QName(PackageNamespace("sample.loaderDanmu"),"CModule")
getlocal3
pushbyte            16
callproperty        QName(PackageNamespace(""),"readString"), 2
setproperty         QName(PackageNamespace(""),"data")
getlocal            9
pushstring          "POST"
coerce_a
setproperty         QName(PackageNamespace(""),"method")
findpropstrict      QName(PackageNamespace("flash.net"),"URLLoader")
constructprop       QName(PackageNamespace("flash.net"),"URLLoader"), 0
getlocal            9
callpropvoid        QName(PackageNamespace(""),"load"), 1

I got the error VerifyError #1023 stack overflow occurred. Is there any problem in my patch? The original SWF uses FlasCC and I'm patching a file generated by FlasCC. I believe _loc3_ is a string buffer.


Solution

  • Finally I got it working. I need to enalrge local stack.

       body
    -  maxstack 3
    +  maxstack 4
       initscopedepth 0