{"action":"closed","issue":{"url":"https://api.github.com/repos/radare/radare2/issues/5735","repository_url":"https://api.github.com/repos/radare/radare2","labels_url":"https://api.github.com/repos/radare/radare2/issues/5735/labels{/name}","comments_url":"https://api.github.com/repos/radare/radare2/issues/5735/comments","events_url":"https://api.github.com/repos/radare/radare2/issues/5735/events","html_url":"https://github.com/radare/radare2/issues/5735","id":176256177,"number":5735,"title":"DEX disam missing information ","user":{"login":"h4ng3r","id":2039733,"avatar_url":"https://avatars.githubusercontent.com/u/2039733?v=3","gravatar_id":"","url":"https://api.github.com/users/h4ng3r","html_url":"https://github.com/h4ng3r","followers_url":"https://api.github.com/users/h4ng3r/followers","following_url":"https://api.github.com/users/h4ng3r/following{/other_user}","gists_url":"https://api.github.com/users/h4ng3r/gists{/gist_id}","starred_url":"https://api.github.com/users/h4ng3r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/h4ng3r/subscriptions","organizations_url":"https://api.github.com/users/h4ng3r/orgs","repos_url":"https://api.github.com/users/h4ng3r/repos","events_url":"https://api.github.com/users/h4ng3r/events{/privacy}","received_events_url":"https://api.github.com/users/h4ng3r/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/radare/radare2/labels/android","name":"android","color":"0052cc"},{"url":"https://api.github.com/repos/radare/radare2/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-11T18:04:37Z","updated_at":"2016-09-24T16:30:40Z","closed_at":"2016-09-24T16:30:40Z","body":"# Wrong Virtual Function Address\r\n\r\n```\r\n;-- LHello.method.foo(I)V:\r\n            0x00000280      05000200       move-wide/from16 v0, v2\r\n            0x00000284      02000000       move/from16 v0, v0\r\n            0x00000288      d1040000       rsub-int v4, v0, 0\r\n        ┌─< 0x0000028c      2a0000006200   goto/32 0x00c4028c          ;[3]\r\n        │   0x00000292      0400           move-wide v0, v0\r\n        │   0x00000294      22010700       new-instance v1, class+7\r\n        │   0x00000298      701009000100   invoke-direct {v1}, 0x0 ; 0x9 ;[1]\r\n```\r\n\r\nThe function should be poitint at 0x00000290, this can be fixed adding 0x10 at virtual methods (as direct methods):\r\n```\r\n\t\t\tsym->paddr = MC + 0x10;\r\n\t\t\tsym->vaddr = MC + 0x10;\r\n```\r\n\r\n# Hide Function Prolog Bytecodes\r\n\r\n```\r\n;-- LHello.method.foo(I)V:\r\n            0x00000280      05000200       move-wide/from16 v0, v2\r\n            0x00000284      02000000       move/from16 v0, v0\r\n            0x00000288      d1040000       rsub-int v4, v0, 0\r\n        ┌─< 0x0000028c      2a0000006200   goto/32 0x00c4028c          ;[3]\r\n        │   0x00000292      0400           move-wide v0, v0\r\n        │   0x00000294      22010700       new-instance v1, class+7\r\n        │   0x00000298      701009000100   invoke-direct {v1}, 0x0 ; 0x9 ;[1]\r\n        │   0x0000029e      1a021500       const-string v2, str.foo___ ; str.foo___\r\n```\r\n\r\nThe first instructions are the prolog of the function, this are (from IDA PRO ;) ):\r\n```\r\nCODE:00000280 word_280:       .short 5                # DATA XREF: CODE:00000500\u0019i\r\nCODE:00000280                                         # Number of registers : 0x5\r\nCODE:00000282                 .short 2                # Size of input args (in words) : 0x2\r\nCODE:00000284                 .short 2                # Size of output args (in words) : 0x2\r\nCODE:00000286                 .short 0                # Number of try_items : 0x0\r\nCODE:00000288                 .int byte_4D1           # Debug info\r\nCODE:0000028C                 .int 0x2A               # Size of bytecode (in 16-bit units): 0x2a\r\n```\r\n\r\nThe bytescodes from 0x00000280 to 0x0000028C should be hidden, maybe showed as metadata or somthing like that.\r\n\r\n# Disassembler uses class_idx instead of type_idx\r\n\r\nThe opcode definition for opcodes like new-instance uses types id, thats why disassambler is not showing all the classes (class+7 should be the classname):\r\n```\r\n;-- LHello.method.foo(I)V:\r\n            0x00000280      05000200       move-wide/from16 v0, v2\r\n            0x00000284      02000000       move/from16 v0, v0\r\n            0x00000288      d1040000       rsub-int v4, v0, 0\r\n        ┌─< 0x0000028c      2a0000006200   goto/32 0x00c4028c          ;[3]\r\n        │   0x00000292      0400           move-wide v0, v0\r\n        │   0x00000294      22010700       new-instance v1, class+7\r\n        │   0x00000298      701009000100   invoke-direct {v1}, 0x0 ; 0x9 ;[1]\r\n```\r\n\r\nThis can be fixes easly (getoffset func of bin_dex.c) :\r\n````\r\n\tcase 'c': // class\r\n\t\tif (idx > 0 && idx <= dex->header.types_size ) {\r\n\t\t\treturn dex->strings[dex->types[idx].descriptor_id];\r\n\t\t}\r\n````\r\n\r\n# Disassembler can get methods name\r\n\r\nThe getoffset for \"m\" return a offset get from the sdb object. Only the methods implemented in the actual application are stored in the sdb, but the opcodes used methods_idx. This can be fixes returning a pointer to the strings array as the last issue. But the problems is that it only gets the function name but also the classname is needed..."}}
{"actor":{"display_login":"h4ng3r"}}