: WARNING - support of the decompiler is now VERY LIMITED. There are no active developers. This means waiting times in the issue tracker are very long and mostly depend on community. Sorry for the inconvenience.

List of issuesList of issues

#1002 CASE / IF EILSE substitution on decomilation
Date created:
Type: bug
Visibility: Everybody
Assigned to:
State: new Help

> What steps will reproduce the problem? I'm decompiling some very similar classes. They describe some protocol data, and have methods to put those data in to binary stream, and read it back. Originally CASE startement used in read method to read data. If I have about 20 cases than decompiller return nice looking case startement, but if case count about 30-40 then it fail decompile in CASE and produce IF ELSE series. I will provide examples of decompilled code and corresponding AVM2 code. ================================================== Correct CASE decompilation ================================================== override public final function readFromSlice(input:IDataInput, bytesAfterSlice:uint) : void { var _loc9_:* = 0; var _loc19_:* = null; var _loc11_:uint = 0; var _loc7_:uint = 0; var _loc8_:uint = 0; var _loc4_:uint = 0; var _loc16_:uint = 0; var _loc21_:uint = 0; var _loc12_:uint = 0; var _loc5_:uint = 0; var _loc15_:uint = 0; var _loc18_:uint = 0; var _loc14_:uint = 0; var _loc20_:uint = 0; var _loc13_:uint = 0; var _loc3_:uint = 0; var _loc10_:uint = 0; var _loc17_:uint = 0; var _loc6_:uint = 0; while(input.bytesAvailable > bytesAfterSlice) { _loc9_ = ReadUtils.name_2(input); switch(_loc9_ >>> 3 - 1) { case 0: if(_loc11_ != 0) { throw new IOError("Bad data format: CommonItemMsg.beginBagType cannot be set twice."); } _loc11_++; beginBagType = ReadUtils.name_3(input); continue; case 1: if(_loc7_ != 0) { throw new IOError("Bad data format: CommonItemMsg.beginObjId cannot be set twice."); } _loc7_++; beginObjId = ReadUtils.name_3(input); continue; case 2: if(_loc8_ != 0) { throw new IOError("Bad data format: CommonItemMsg.beginPos cannot be set twice."); } _loc8_++; beginPos = ReadUtils.name_3(input); continue; case 3: if(_loc4_ != 0) { throw new IOError("Bad data format: CommonItemMsg.endBagType cannot be set twice."); } _loc4_++; endBagType = ReadUtils.name_3(input); continue; case 4: if(_loc16_ != 0) { throw new IOError("Bad data format: CommonItemMsg.endObjId cannot be set twice."); } _loc16_++; endObjId = ReadUtils.name_3(input); continue; case 5: if(_loc21_ != 0) { throw new IOError("Bad data format: CommonItemMsg.endPos cannot be set twice."); } _loc21_++; endPos = ReadUtils.name_3(input); continue; case 6: if(_loc12_ != 0) { throw new IOError("Bad data format: CommonItemMsg.count cannot be set twice."); } _loc12_++; count = ReadUtils.name_3(input); continue; case 7: if(_loc5_ != 0) { throw new IOError("Bad data format: CommonItemMsg.objectId cannot be set twice."); } _loc5_++; objectId = ReadUtils.name_3(input); continue; case 8: if(_loc15_ != 0) { throw new IOError("Bad data format: CommonItemMsg.composeId cannot be set twice."); } _loc15_++; composeId = ReadUtils.name_3(input); continue; case 9: if(_loc18_ != 0) { throw new IOError("Bad data format: CommonItemMsg.composeNum cannot be set twice."); } _loc18_++; composeNum = ReadUtils.name_3(input); continue; case 10: if(_loc14_ != 0) { throw new IOError("Bad data format: CommonItemMsg.autoBuy cannot be set twice."); } _loc14_++; autoBuy = ReadUtils.name_11(input); continue; case 11: if(_loc20_ != 0) { throw new IOError("Bad data format: CommonItemMsg.opType cannot be set twice."); } _loc20_++; opType = ReadUtils.name_3(input); continue; case 12: if(_loc13_ != 0) { throw new IOError("Bad data format: CommonItemMsg.holePos cannot be set twice."); } _loc13_++; holePos = ReadUtils.name_3(input); continue; case 13: if(_loc3_ != 0) { throw new IOError("Bad data format: CommonItemMsg.operate cannot be set twice."); } _loc3_++; operate = ReadUtils.name_11(input); continue; case 14: if(_loc10_ != 0) { throw new IOError("Bad data format: CommonItemMsg.payType cannot be set twice."); } _loc10_++; payType = ReadUtils.name_3(input); continue; case 15: if((_loc9_ & 7) == 2) { ReadUtils.readPackedRepeated(input,ReadUtils.name_11,lock); } else { lock.push(ReadUtils.name_11(input)); } continue; case 16: if(_loc17_ != 0) { throw new IOError("Bad data format: CommonItemMsg.bindType cannot be set twice."); } _loc17_++; bindType = ReadUtils.name_3(input); continue; case 17: if(_loc6_ != 0) { throw new IOError("Bad data format: CommonItemMsg.property1 cannot be set twice."); } _loc6_++; property1 = ReadUtils.name_3(input); continue; case 18: _loc19_ = new SellItemMsg(); ReadUtils.name_7(input,_loc19_); sellItem.push(_loc19_); continue; default: ReadUtils.skip(input,_loc9_ & 7); continue; } } } ================================================== Corresponding AVM2 code ================================================== trait method Qname(PackageNamespace(""),"readFromSlice") dispid 0 method name "readFromSlice" flag HAS_PARAM_NAMES param Qname(PackageNamespace("flash.utils"),"IDataInput") param Qname(PackageNamespace(""),"uint") paramname "input" paramname "bytesAfterSlice" returns Qname(PackageNamespace(""),"void") body maxstack 4 localcount 22 initscopedepth 0 maxscopedepth 1 code getlocal_0 pushscope pushbyte 0 setlocal 9 pushnull setlocal 19 pushbyte 0 convert_u setlocal 11 pushbyte 0 convert_u setlocal 7 pushbyte 0 convert_u setlocal 8 pushbyte 0 convert_u setlocal 4 pushbyte 0 convert_u setlocal 16 pushbyte 0 convert_u setlocal 21 pushbyte 0 convert_u setlocal 12 pushbyte 0 convert_u setlocal 5 pushbyte 0 convert_u setlocal 15 pushbyte 0 convert_u setlocal 18 pushbyte 0 convert_u setlocal 14 pushbyte 0 convert_u setlocal 20 pushbyte 0 convert_u setlocal 13 pushbyte 0 convert_u setlocal_3 pushbyte 0 convert_u setlocal 10 pushbyte 0 convert_u setlocal 17 pushbyte 0 convert_u setlocal 6 jump ofs0374 ofs0061:label getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_2") 1 convert_u dup setlocal 9 pushbyte 3 urshift convert_i pushint 1 subtract_i lookupswitch ofs0369 18 ofs00b1 ofs00d6 ofs00fb ofs0120 ofs0145 ofs016a ofs018f ofs01b4 ofs01d9 ofs01fe ofs0223 ofs0248 ofs026d ofs0292 ofs02b4 ofs02d9 ofs0303 ofs0328 ofs034d ofs00b1:getlocal 11 pushbyte 0 ifeq ofs00c1 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.beginBagType cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs00c1:getlocal 11 increment convert_u setlocal 11 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"beginBagType") swap setproperty Qname(PackageNamespace(""),"beginBagType") jump ofs0374 ofs00d6:getlocal 7 pushbyte 0 ifeq ofs00e6 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.beginObjId cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs00e6:getlocal 7 increment convert_u setlocal 7 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"beginObjId") swap setproperty Qname(PackageNamespace(""),"beginObjId") jump ofs0374 ofs00fb:getlocal 8 pushbyte 0 ifeq ofs010b findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.beginPos cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs010b:getlocal 8 increment convert_u setlocal 8 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"beginPos") swap setproperty Qname(PackageNamespace(""),"beginPos") jump ofs0374 ofs0120:getlocal 4 pushbyte 0 ifeq ofs0130 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.endBagType cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs0130:getlocal 4 increment convert_u setlocal 4 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"endBagType") swap setproperty Qname(PackageNamespace(""),"endBagType") jump ofs0374 ofs0145:getlocal 16 pushbyte 0 ifeq ofs0155 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.endObjId cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs0155:getlocal 16 increment convert_u setlocal 16 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"endObjId") swap setproperty Qname(PackageNamespace(""),"endObjId") jump ofs0374 ofs016a:getlocal 21 pushbyte 0 ifeq ofs017a findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.endPos cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs017a:getlocal 21 increment convert_u setlocal 21 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"endPos") swap setproperty Qname(PackageNamespace(""),"endPos") jump ofs0374 ofs018f:getlocal 12 pushbyte 0 ifeq ofs019f findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.count cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs019f:getlocal 12 increment convert_u setlocal 12 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"count") swap setproperty Qname(PackageNamespace(""),"count") jump ofs0374 ofs01b4:getlocal 5 pushbyte 0 ifeq ofs01c4 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.objectId cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs01c4:getlocal 5 increment convert_u setlocal 5 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"objectId") swap setproperty Qname(PackageNamespace(""),"objectId") jump ofs0374 ofs01d9:getlocal 15 pushbyte 0 ifeq ofs01e9 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.composeId cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs01e9:getlocal 15 increment convert_u setlocal 15 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"composeId") swap setproperty Qname(PackageNamespace(""),"composeId") jump ofs0374 ofs01fe:getlocal 18 pushbyte 0 ifeq ofs020e findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.composeNum cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs020e:getlocal 18 increment convert_u setlocal 18 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"composeNum") swap setproperty Qname(PackageNamespace(""),"composeNum") jump ofs0374 ofs0223:getlocal 14 pushbyte 0 ifeq ofs0233 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.autoBuy cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs0233:getlocal 14 increment convert_u setlocal 14 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_11") 1 findproperty Qname(PackageNamespace(""),"autoBuy") swap setproperty Qname(PackageNamespace(""),"autoBuy") jump ofs0374 ofs0248:getlocal 20 pushbyte 0 ifeq ofs0258 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.opType cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs0258:getlocal 20 increment convert_u setlocal 20 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"opType") swap setproperty Qname(PackageNamespace(""),"opType") jump ofs0374 ofs026d:getlocal 13 pushbyte 0 ifeq ofs027d findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.holePos cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs027d:getlocal 13 increment convert_u setlocal 13 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"holePos") swap setproperty Qname(PackageNamespace(""),"holePos") jump ofs0374 ofs0292:getlocal_3 pushbyte 0 ifeq ofs02a1 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.operate cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs02a1:getlocal_3 increment convert_u setlocal_3 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_11") 1 findproperty Qname(PackageNamespace(""),"operate") swap setproperty Qname(PackageNamespace(""),"operate") jump ofs0374 ofs02b4:getlocal 10 pushbyte 0 ifeq ofs02c4 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.payType cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs02c4:getlocal 10 increment convert_u setlocal 10 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"payType") swap setproperty Qname(PackageNamespace(""),"payType") jump ofs0374 ofs02d9:getlocal 9 pushbyte 7 bitand pushbyte 2 ifne ofs02f4 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getproperty Qname(PackageNamespace(""),"name_11") getlex Qname(PackageNamespace(""),"lock") callpropvoid Qname(PackageNamespace(""),"readPackedRepeated") 3 jump ofs0374 ofs02f4:getlex Qname(PackageNamespace(""),"lock") getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_11") 1 callpropvoid Qname(Namespace("http://adobe.com/AS3/2006/builtin"),"push") 1 jump ofs0374 ofs0303:getlocal 17 pushbyte 0 ifeq ofs0313 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.bindType cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs0313:getlocal 17 increment convert_u setlocal 17 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"bindType") swap setproperty Qname(PackageNamespace(""),"bindType") jump ofs0374 ofs0328:getlocal 6 pushbyte 0 ifeq ofs0338 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: CommonItemMsg.property1 cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs0338:getlocal 6 increment convert_u setlocal 6 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"property1") swap setproperty Qname(PackageNamespace(""),"property1") jump ofs0374 ofs034d:findpropstrict Qname(PackageNamespace("com.road.yishi.proto.item"),"SellItemMsg") constructprop Qname(PackageNamespace("com.road.yishi.proto.item"),"SellItemMsg") 0 coerce Qname(PackageNamespace("com.road.yishi.proto.item"),"SellItemMsg") setlocal 19 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 getlocal 19 callpropvoid Qname(PackageNamespace(""),"name_7") 2 getlex Qname(PackageNamespace(""),"sellItem") getlocal 19 callpropvoid Qname(Namespace("http://adobe.com/AS3/2006/builtin"),"push") 1 jump ofs0374 ofs0369:getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 getlocal 9 pushbyte 7 bitand callpropvoid Qname(PackageNamespace(""),"skip") 2 ofs0374:getlocal_1 getproperty Qname(Namespace("flash.utils:IDataInput"),"bytesAvailable") getlocal_2 ifgt ofs0061 returnvoid ================================================== Failed CASE decompilation ================================================== override public final function readFromSlice(input:IDataInput, bytesAfterSlice:uint) : void { var _loc7_:* = 0; var _loc20_:uint = 0; var _loc16_:uint = 0; var _loc26_:uint = 0; var _loc8_:uint = 0; var _loc6_:uint = 0; var _loc31_:uint = 0; var _loc39_:uint = 0; var _loc12_:uint = 0; var _loc41_:uint = 0; var _loc24_:uint = 0; var _loc28_:uint = 0; var _loc21_:uint = 0; var _loc15_:uint = 0; var _loc35_:uint = 0; var _loc9_:uint = 0; var _loc5_:uint = 0; var _loc13_:uint = 0; var _loc32_:uint = 0; var _loc17_:uint = 0; var _loc23_:uint = 0; var _loc37_:uint = 0; var _loc14_:uint = 0; var _loc33_:uint = 0; var _loc30_:uint = 0; var _loc36_:uint = 0; var _loc4_:uint = 0; var _loc19_:uint = 0; var _loc18_:uint = 0; var _loc25_:uint = 0; var _loc22_:uint = 0; var _loc34_:uint = 0; var _loc27_:uint = 0; var _loc11_:uint = 0; var _loc38_:uint = 0; var _loc10_:uint = 0; var _loc29_:uint = 0; var _loc40_:uint = 0; var _loc3_:uint = 0; while(input.bytesAvailable > bytesAfterSlice) { _loc7_ = ReadUtils.name_2(input); var _loc42_:* = _loc7_ >>> 3; if(1 !== _loc42_) { if(2 !== _loc42_) { if(3 !== _loc42_) { if(4 !== _loc42_) { if(5 !== _loc42_) { if(6 !== _loc42_) { if(7 !== _loc42_) { if(8 !== _loc42_) { if(9 !== _loc42_) { if(10 !== _loc42_) { if(11 !== _loc42_) { if(12 !== _loc42_) { if(13 !== _loc42_) { if(14 !== _loc42_) { if(15 !== _loc42_) { if(16 !== _loc42_) { if(17 !== _loc42_) { if(18 !== _loc42_) { if(19 !== _loc42_) { if(20 !== _loc42_) { if(21 !== _loc42_) { if(22 !== _loc42_) { if(23 !== _loc42_) { if(24 !== _loc42_) { if(25 !== _loc42_) { if(26 !== _loc42_) { if(27 !== _loc42_) { if(28 !== _loc42_) { if(29 !== _loc42_) { if(30 !== _loc42_) { if(31 !== _loc42_) { if(32 !== _loc42_) { if(33 !== _loc42_) { if(34 !== _loc42_) { if(35 !== _loc42_) { if(36 !== _loc42_) { if(37 !== _loc42_) { if(38 !== _loc42_) { ReadUtils.skip(input,_loc7_ & 7); } else { if(_loc3_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.lifeSkill cannot be set twice."); } _loc3_++; lifeSkill = ReadUtils.name_3(input); } } else { if(_loc40_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.descTemplateId cannot be set twice."); } _loc40_++; descTemplateId = ReadUtils.name_3(input); } } else { if(_loc29_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.strBlessValue cannot be set twice."); } _loc29_++; strBlessValue = ReadUtils.name_3(input); } } else { if(_loc10_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.isLocked cannot be set twice."); } _loc10_++; isLocked = ReadUtils.name_11(input); } } else { if(_loc38_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.appraisalSkill cannot be set twice."); } _loc38_++; appraisalSkill = ReadUtils.name_3(input); } } else { if(_loc11_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.blessValue cannot be set twice."); } _loc11_++; blessValue = ReadUtils.name_3(input); } } else { if(_loc27_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.mouldGrade cannot be set twice."); } _loc27_++; mouldGrade = ReadUtils.name_3(input); } } else { if(_loc34_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.tenacity cannot be set twice."); } _loc34_++; tenacity = ReadUtils.name_3(input); } } else { if(_loc22_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.strength cannot be set twice."); } _loc22_++; strength = ReadUtils.name_3(input); } } else { if(_loc25_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.property1 cannot be set twice."); } _loc25_++; property1 = ReadUtils.name_10(input); } } else { if(_loc18_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.userId cannot be set twice."); } _loc18_++; userId = ReadUtils.name_3(input); } } else { if(_loc19_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.isNew cannot be set twice."); } _loc19_++; isNew = ReadUtils.name_11(input); } } else { if(_loc4_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.randomSkill_5 cannot be set twice."); } _loc4_++; randomSkill_5 = ReadUtils.name_3(input); } } else { if(_loc36_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.randomSkill_4 cannot be set twice."); } _loc36_++; randomSkill_4 = ReadUtils.name_3(input); } } else { if(_loc30_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.randomSkill_3 cannot be set twice."); } _loc30_++; randomSkill_3 = ReadUtils.name_3(input); } } else { if(_loc33_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.randomSkill_2 cannot be set twice."); } _loc33_++; randomSkill_2 = ReadUtils.name_3(input); } } else { if(_loc14_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.randomSkill_1 cannot be set twice."); } _loc14_++; randomSkill_1 = ReadUtils.name_3(input); } } else { if(_loc37_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.join_4 cannot be set twice."); } _loc37_++; join_4 = ReadUtils.name_3(input); } } else { if(_loc23_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.join_3 cannot be set twice."); } _loc23_++; join_3 = ReadUtils.name_3(input); } } else { if(_loc17_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.join_2 cannot be set twice."); } _loc17_++; join_2 = ReadUtils.name_3(input); } } else { if(_loc32_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.join_1 cannot be set twice."); } _loc32_++; join_1 = ReadUtils.name_3(input); } } else { if(_loc13_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.strengthenGrade cannot be set twice."); } _loc13_++; strengthenGrade = ReadUtils.name_3(input); } } else { if(_loc5_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.captain cannot be set twice."); } _loc5_++; captain = ReadUtils.name_3(input); } } else { if(_loc9_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.ability cannot be set twice."); } _loc9_++; ability = ReadUtils.name_3(input); } } else { if(_loc35_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.agility cannot be set twice."); } _loc35_++; agility = ReadUtils.name_3(input); } } else { if(_loc15_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.defence cannot be set twice."); } _loc15_++; defence = ReadUtils.name_3(input); } } else { if(_loc21_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.attack cannot be set twice."); } _loc21_++; attack = ReadUtils.name_3(input); } } else { if(_loc28_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.count cannot be set twice."); } _loc28_++; count = ReadUtils.name_3(input); } } else { if(_loc24_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.beginDate cannot be set twice."); } _loc24_++; beginDate = ReadUtils.name_10(input); } } else { if(_loc41_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.validDate cannot be set twice."); } _loc41_++; validDate = ReadUtils.name_3(input); } } else { if(_loc12_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.used cannot be set twice."); } _loc12_++; used = ReadUtils.name_11(input); } } else { if(_loc39_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.bind cannot be set twice."); } _loc39_++; bind = ReadUtils.name_11(input); } } else { if(_loc31_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.bagType cannot be set twice."); } _loc31_++; bagType = ReadUtils.name_3(input); } } else { if(_loc6_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.objectId cannot be set twice."); } _loc6_++; objectId = ReadUtils.name_3(input); } } else { if(_loc8_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.exist cannot be set twice."); } _loc8_++; exist = ReadUtils.name_11(input); } } else { if(_loc26_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.pos cannot be set twice."); } _loc26_++; pos = ReadUtils.name_3(input); } } else { if(_loc16_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.templateId cannot be set twice."); } _loc16_++; templateId = ReadUtils.name_3(input); } } else { if(_loc20_ != 0) { throw new IOError("Bad data format: ItemInfoMsg.id cannot be set twice."); } _loc20_++; id = ReadUtils.name_3(input); } } } ================================================== Corresponding AVM2 code ================================================== trait method Qname(PackageNamespace(""),"readFromSlice") dispid 0 method name "readFromSlice" flag HAS_PARAM_NAMES param Qname(PackageNamespace("flash.utils"),"IDataInput") param Qname(PackageNamespace(""),"uint") paramname "input" paramname "bytesAfterSlice" returns Qname(PackageNamespace(""),"void") body maxstack 4 localcount 43 initscopedepth 0 maxscopedepth 1 code getlocal_0 pushscope pushbyte 0 setlocal 7 pushbyte 0 convert_u setlocal 20 pushbyte 0 convert_u setlocal 16 pushbyte 0 convert_u setlocal 26 pushbyte 0 convert_u setlocal 8 pushbyte 0 convert_u setlocal 6 pushbyte 0 convert_u setlocal 31 pushbyte 0 convert_u setlocal 39 pushbyte 0 convert_u setlocal 12 pushbyte 0 convert_u setlocal 41 pushbyte 0 convert_u setlocal 24 pushbyte 0 convert_u setlocal 28 pushbyte 0 convert_u setlocal 21 pushbyte 0 convert_u setlocal 15 pushbyte 0 convert_u setlocal 35 pushbyte 0 convert_u setlocal 9 pushbyte 0 convert_u setlocal 5 pushbyte 0 convert_u setlocal 13 pushbyte 0 convert_u setlocal 32 pushbyte 0 convert_u setlocal 17 pushbyte 0 convert_u setlocal 23 pushbyte 0 convert_u setlocal 37 pushbyte 0 convert_u setlocal 14 pushbyte 0 convert_u setlocal 33 pushbyte 0 convert_u setlocal 30 pushbyte 0 convert_u setlocal 36 pushbyte 0 convert_u setlocal 4 pushbyte 0 convert_u setlocal 19 pushbyte 0 convert_u setlocal 18 pushbyte 0 convert_u setlocal 25 pushbyte 0 convert_u setlocal 22 pushbyte 0 convert_u setlocal 34 pushbyte 0 convert_u setlocal 27 pushbyte 0 convert_u setlocal 11 pushbyte 0 convert_u setlocal 38 pushbyte 0 convert_u setlocal 10 pushbyte 0 convert_u setlocal 29 pushbyte 0 convert_u setlocal 40 pushbyte 0 convert_u setlocal_3 jump ofs0892 ofs00c7:label getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_2") 1 convert_u dup setlocal 7 pushbyte 3 urshift setlocal 42 jump ofs075e ofs00dd:label getlocal 20 pushbyte 0 ifeq ofs00f1 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.id cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs00f1:getlocal 20 increment convert_u setlocal 20 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"id") swap setproperty Qname(PackageNamespace(""),"id") jump ofs0892 ofs0108:label getlocal 16 pushbyte 0 ifeq ofs011c findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.templateId cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs011c:getlocal 16 increment convert_u setlocal 16 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"templateId") swap setproperty Qname(PackageNamespace(""),"templateId") jump ofs0892 ofs0133:label getlocal 26 pushbyte 0 ifeq ofs0147 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.pos cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs0147:getlocal 26 increment convert_u setlocal 26 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"pos") swap setproperty Qname(PackageNamespace(""),"pos") jump ofs0892 ofs015e:label getlocal 8 pushbyte 0 ifeq ofs0172 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.exist cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs0172:getlocal 8 increment convert_u setlocal 8 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_11") 1 findproperty Qname(PackageNamespace(""),"exist") swap setproperty Qname(PackageNamespace(""),"exist") jump ofs0892 ofs0189:label getlocal 6 pushbyte 0 ifeq ofs019d findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.objectId cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs019d:getlocal 6 increment convert_u setlocal 6 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"objectId") swap setproperty Qname(PackageNamespace(""),"objectId") jump ofs0892 ofs01b4:label getlocal 31 pushbyte 0 ifeq ofs01c8 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.bagType cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs01c8:getlocal 31 increment convert_u setlocal 31 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"bagType") swap setproperty Qname(PackageNamespace(""),"bagType") jump ofs0892 ofs01df:label getlocal 39 pushbyte 0 ifeq ofs01f3 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.bind cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs01f3:getlocal 39 increment convert_u setlocal 39 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_11") 1 findproperty Qname(PackageNamespace(""),"bind") swap setproperty Qname(PackageNamespace(""),"bind") jump ofs0892 ofs020a:label getlocal 12 pushbyte 0 ifeq ofs021e findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.used cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs021e:getlocal 12 increment convert_u setlocal 12 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_11") 1 findproperty Qname(PackageNamespace(""),"used") swap setproperty Qname(PackageNamespace(""),"used") jump ofs0892 ofs0235:label getlocal 41 pushbyte 0 ifeq ofs0249 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.validDate cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs0249:getlocal 41 increment convert_u setlocal 41 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"validDate") swap setproperty Qname(PackageNamespace(""),"validDate") jump ofs0892 ofs0260:label getlocal 24 pushbyte 0 ifeq ofs0274 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.beginDate cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs0274:getlocal 24 increment convert_u setlocal 24 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_10") 1 findproperty Qname(PackageNamespace(""),"beginDate") swap setproperty Qname(PackageNamespace(""),"beginDate") jump ofs0892 ofs028b:label getlocal 28 pushbyte 0 ifeq ofs029f findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.count cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs029f:getlocal 28 increment convert_u setlocal 28 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"count") swap setproperty Qname(PackageNamespace(""),"count") jump ofs0892 ofs02b6:label getlocal 21 pushbyte 0 ifeq ofs02ca findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.attack cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs02ca:getlocal 21 increment convert_u setlocal 21 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"attack") swap setproperty Qname(PackageNamespace(""),"attack") jump ofs0892 ofs02e1:label getlocal 15 pushbyte 0 ifeq ofs02f5 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.defence cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs02f5:getlocal 15 increment convert_u setlocal 15 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"defence") swap setproperty Qname(PackageNamespace(""),"defence") jump ofs0892 ofs030c:label getlocal 35 pushbyte 0 ifeq ofs0320 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.agility cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs0320:getlocal 35 increment convert_u setlocal 35 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"agility") swap setproperty Qname(PackageNamespace(""),"agility") jump ofs0892 ofs0337:label getlocal 9 pushbyte 0 ifeq ofs034b findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.ability cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs034b:getlocal 9 increment convert_u setlocal 9 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"ability") swap setproperty Qname(PackageNamespace(""),"ability") jump ofs0892 ofs0362:label getlocal 5 pushbyte 0 ifeq ofs0376 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.captain cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs0376:getlocal 5 increment convert_u setlocal 5 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"captain") swap setproperty Qname(PackageNamespace(""),"captain") jump ofs0892 ofs038d:label getlocal 13 pushbyte 0 ifeq ofs03a1 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.strengthenGrade cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs03a1:getlocal 13 increment convert_u setlocal 13 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"strengthenGrade") swap setproperty Qname(PackageNamespace(""),"strengthenGrade") jump ofs0892 ofs03b8:label getlocal 32 pushbyte 0 ifeq ofs03cc findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.join_1 cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs03cc:getlocal 32 increment convert_u setlocal 32 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"join_1") swap setproperty Qname(PackageNamespace(""),"join_1") jump ofs0892 ofs03e3:label getlocal 17 pushbyte 0 ifeq ofs03f7 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.join_2 cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs03f7:getlocal 17 increment convert_u setlocal 17 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"join_2") swap setproperty Qname(PackageNamespace(""),"join_2") jump ofs0892 ofs040e:label getlocal 23 pushbyte 0 ifeq ofs0422 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.join_3 cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs0422:getlocal 23 increment convert_u setlocal 23 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"join_3") swap setproperty Qname(PackageNamespace(""),"join_3") jump ofs0892 ofs0439:label getlocal 37 pushbyte 0 ifeq ofs044d findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.join_4 cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs044d:getlocal 37 increment convert_u setlocal 37 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"join_4") swap setproperty Qname(PackageNamespace(""),"join_4") jump ofs0892 ofs0464:label getlocal 14 pushbyte 0 ifeq ofs0478 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.randomSkill_1 cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs0478:getlocal 14 increment convert_u setlocal 14 getlex Qname(PackageNamespace("com.netease.protobuf"),"ReadUtils") getlocal_1 callproperty Qname(PackageNamespace(""),"name_3") 1 findproperty Qname(PackageNamespace(""),"randomSkill_1") swap setproperty Qname(PackageNamespace(""),"randomSkill_1") jump ofs0892 ofs048f:label getlocal 33 pushbyte 0 ifeq ofs04a3 findpropstrict Qname(PackageNamespace("flash.errors"),"IOError") pushstring "Bad data format: ItemInfoMsg.randomSkill_2 cannot be set twice." constructprop Qname(PackageNamespace("flash.errors"),"IOError") 1 throw ofs04a3:getlocal 33 increment convert_u
user
> What steps will reproduce the problem? I'm decompiling some very similar classes. They describe some protocol data, and have methods to put those data in to binary stream, and read it back. Originally CASE startement used in read method to read data. If I have about 20 cases than decompiller return nice looking case startement, but if case count about 30-40 then it fail decompile in CASE and produce IF ELSE series. I will provide examples of decompilled code and corresponding AVM2 code. They are in attached files > What is the expected output? What do you see instead? I expect correctly decomiled CASE startements. I see IF ELSE instead. > What version of the product are you using? Is it "nightly build"? Which operating system do you have? JPEXS FreeFlash Decompiler v.6.0.1 > Please provide any additional information below. If the problem is related to a SWF file, attach it here, otherwise we can't help you. Before V6 JPEXS FreeFlash Decompiler all those decomiled as IF ELSE, also on BIG amount of CASE branches decompilation failed. Also I noticed that decompiling classes with those case startements take than decompiler failed to produce CASE take very long time.
 
Google Translate: Translate to Czech Translate to Slovak Translate to Russian Translate to Hungarian Translate to Swedish Translate to French Translate to German Translate to Spanish Translate to Italian
Change style: oceanic classic