{"action":"created","issue":{"url":"https://api.github.com/repos/radare/radare2/issues/5625","repository_url":"https://api.github.com/repos/radare/radare2","labels_url":"https://api.github.com/repos/radare/radare2/issues/5625/labels{/name}","comments_url":"https://api.github.com/repos/radare/radare2/issues/5625/comments","events_url":"https://api.github.com/repos/radare/radare2/issues/5625/events","html_url":"https://github.com/radare/radare2/issues/5625","id":173609261,"number":5625,"title":"Calling convention corrupted on loading project","user":{"login":"laanwj","id":126646,"avatar_url":"https://avatars.githubusercontent.com/u/126646?v=3","gravatar_id":"","url":"https://api.github.com/users/laanwj","html_url":"https://github.com/laanwj","followers_url":"https://api.github.com/users/laanwj/followers","following_url":"https://api.github.com/users/laanwj/following{/other_user}","gists_url":"https://api.github.com/users/laanwj/gists{/gist_id}","starred_url":"https://api.github.com/users/laanwj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laanwj/subscriptions","organizations_url":"https://api.github.com/users/laanwj/orgs","repos_url":"https://api.github.com/users/laanwj/repos","events_url":"https://api.github.com/users/laanwj/events{/privacy}","received_events_url":"https://api.github.com/users/laanwj/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":{"login":"oddcoder","id":10424605,"avatar_url":"https://avatars.githubusercontent.com/u/10424605?v=3","gravatar_id":"","url":"https://api.github.com/users/oddcoder","html_url":"https://github.com/oddcoder","followers_url":"https://api.github.com/users/oddcoder/followers","following_url":"https://api.github.com/users/oddcoder/following{/other_user}","gists_url":"https://api.github.com/users/oddcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/oddcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oddcoder/subscriptions","organizations_url":"https://api.github.com/users/oddcoder/orgs","repos_url":"https://api.github.com/users/oddcoder/repos","events_url":"https://api.github.com/users/oddcoder/events{/privacy}","received_events_url":"https://api.github.com/users/oddcoder/received_events","type":"User","site_admin":false},"assignees":[{"login":"oddcoder","id":10424605,"avatar_url":"https://avatars.githubusercontent.com/u/10424605?v=3","gravatar_id":"","url":"https://api.github.com/users/oddcoder","html_url":"https://github.com/oddcoder","followers_url":"https://api.github.com/users/oddcoder/followers","following_url":"https://api.github.com/users/oddcoder/following{/other_user}","gists_url":"https://api.github.com/users/oddcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/oddcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oddcoder/subscriptions","organizations_url":"https://api.github.com/users/oddcoder/orgs","repos_url":"https://api.github.com/users/oddcoder/repos","events_url":"https://api.github.com/users/oddcoder/events{/privacy}","received_events_url":"https://api.github.com/users/oddcoder/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/radare/radare2/milestones/15","html_url":"https://github.com/radare/radare2/milestones/0.10.6","labels_url":"https://api.github.com/repos/radare/radare2/milestones/15/labels","id":1869518,"number":15,"title":"0.10.6","description":"","creator":{"login":"XVilka","id":203261,"avatar_url":"https://avatars.githubusercontent.com/u/203261?v=3","gravatar_id":"","url":"https://api.github.com/users/XVilka","html_url":"https://github.com/XVilka","followers_url":"https://api.github.com/users/XVilka/followers","following_url":"https://api.github.com/users/XVilka/following{/other_user}","gists_url":"https://api.github.com/users/XVilka/gists{/gist_id}","starred_url":"https://api.github.com/users/XVilka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/XVilka/subscriptions","organizations_url":"https://api.github.com/users/XVilka/orgs","repos_url":"https://api.github.com/users/XVilka/repos","events_url":"https://api.github.com/users/XVilka/events{/privacy}","received_events_url":"https://api.github.com/users/XVilka/received_events","type":"User","site_admin":false},"open_issues":93,"closed_issues":32,"state":"open","created_at":"2016-07-07T09:13:48Z","updated_at":"2016-09-04T10:45:40Z","due_on":"2016-09-26T00:00:00Z","closed_at":null},"comments":12,"created_at":"2016-08-27T18:35:13Z","updated_at":"2016-09-04T10:59:25Z","closed_at":"2016-09-03T15:59:33Z","body":"When loading a certain project I get a list of these errors:\r\n```\r\nUnknown calling convention 'cc.cdecl.name'\r\nSee afCl for available types\r\nUnknown calling convention 'cc.cdecl.name'\r\nSee afCl for available types\r\nUnknown calling convention 'cc.cdecl.name'\r\nSee afCl for available types\r\n```\r\nLooking at the project file, the calling convention is indeed messed up\r\n```\r\n...\r\nafC cc.cdecl.name @ 0x080483f8\r\n...\r\n```\r\nI tried fixing this up manually but to no avail: the next time radare saves the project file, the ccs are messed up again. They get corrupted to an apparently random string, but note that all of them get corrupted to the same value.\r\n\r\nThe `af->cc` is set to the default calling convention for the target in `anal/fcn.c`:\r\n```c++\r\nfcn->cc = r_anal_cc_default (a);\r\n```\r\nWhich internally fetches a constant from the sdb database\r\n```\r\nreturn sdb_const_get (DB, \"default.cc\", 0);\r\n```\r\nIt's the underlying value in the database that changes, not the pointer to it in the fcn structure, so I tried putting a watchpoint on it. This gave the following traceback:\r\n```\r\n#0  memset () at /usr/src/lib/libc/arch/amd64/string/memset.S:46\r\n#1  0x0000160403e50783 in ofree (p=0x16033c4c55e0) at /usr/src/lib/libc/stdlib/malloc.c:1243\r\n#2  0x0000160403e5098e in free (ptr=0x16033c4c55e0) at /usr/src/lib/libc/stdlib/malloc.c:1287\r\n#3  0x00001603622832c9 in sdb_kv_free (kv=0x1603f55b0da0) at sdb.c:414\r\n#4  0x000016036227ff36 in ls_delete (list=0x1603f55b09c0, iter=0x16037b12cd20) at ls.c:34\r\n#5  0x000016036227ff83 in ls_destroy (list=0x1603f55b09c0) at ls.c:55\r\n#6  0x000016036227ffc2 in ls_free (list=0x1603f55b09c0) at ls.c:64\r\n#7  0x000016036227d61e in ht_free (ht=0x16040f05d040) at ht.c:161\r\n#8  0x0000160362284543 in sdb_reset (s=0x16039192c000) at sdb.c:375\r\n#9  0x0000160331f63c92 in r_core_anal_cc_init (core=0x160127b08880) at cbin.c:468\r\n#10 0x0000160331f43347 in cb_asmarch (user=0x160127b08880, data=0x1603840a1000) at config.c:267\r\n#11 0x000016039850089e in r_config_set (cfg=0x160382dd6d40, name=0x1603320ce74a \"asm.arch\", value=0x16042155a930 \"x86\") at config.c:260\r\n#12 0x0000160398501403 in r_config_bump (cfg=0x160382dd6d40, key=0x1603320ce74a \"asm.arch\") at config.c:471\r\n#13 0x0000160331f808e0 in r_core_project_open (core=0x160127b08880, prjfile=0x1603fd58b570 \"\") at project.c:293\r\n#14 0x00001601277057b4 in main (argc=3, argv=0x7f7ffffd2e68, envp=0x7f7ffffd2e88) at radare2.c:753\r\n```\r\nApparently the \"constant\" is overwritten with something else. The cc pointers in the functions ares effectively dangling pointers now. So next time the project is saved the cc values are messed up.\r\n"},"comment":{"url":"https://api.github.com/repos/radare/radare2/issues/comments/244596511","html_url":"https://github.com/radare/radare2/issues/5625#issuecomment-244596511","issue_url":"https://api.github.com/repos/radare/radare2/issues/5625","id":244596511,"user":{"login":"oddcoder","id":10424605,"avatar_url":"https://avatars.githubusercontent.com/u/10424605?v=3","gravatar_id":"","url":"https://api.github.com/users/oddcoder","html_url":"https://github.com/oddcoder","followers_url":"https://api.github.com/users/oddcoder/followers","following_url":"https://api.github.com/users/oddcoder/following{/other_user}","gists_url":"https://api.github.com/users/oddcoder/gists{/gist_id}","starred_url":"https://api.github.com/users/oddcoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oddcoder/subscriptions","organizations_url":"https://api.github.com/users/oddcoder/orgs","repos_url":"https://api.github.com/users/oddcoder/repos","events_url":"https://api.github.com/users/oddcoder/events{/privacy}","received_events_url":"https://api.github.com/users/oddcoder/received_events","type":"User","site_admin":false},"created_at":"2016-09-04T10:59:25Z","updated_at":"2016-09-04T10:59:25Z","body":"\\o/"}}
{"actor":{"display_login":"oddcoder"}}