{"action":"created","comment":{"url":"https://api.github.com/repos/unicorn-engine/unicorn/pulls/comments/51584419","id":51584419,"diff_hunk":"@@ -729,6 +729,56 @@ static void test_x86_16(void **state)\n \n /******************************************************************************/\n \n+\n+/******************************************************************************/\n+\n+// callback for SYSCALL instruction (X86).\n+static void hook_empty_bb(uc_engine *uc, uint64_t addr, uint64_t bb_size, void *user_data)\n+{\n+    if(bb_size == 0) {\n+        fail_msg(\"Invalid Basic Block Size, shouldn't be 0\");\n+    }\n+    assert_int_equal(9, bb_size);\n+}\n+\n+static void test_x86_64_empty_bb(void **state)\n+{\n+    uc_engine *uc;\n+    uc_hook trace1;\n+    uc_err err;\n+\n+    static const uint64_t address = 0x40000;\n+    static const uint8_t code[] = {\n+        0x83, 0xc0, 0x01,  //add eax, 1\n+        0x83, 0xc0, 0x02,  //add eax, 2\n+        0x83, 0xc0, 0x03   //add eax, 3\n+    };\n+\n+    // Initialize emulator in X86-64bit mode\n+    err = uc_open(UC_ARCH_X86, UC_MODE_64, &uc);\n+    uc_assert_success(err);\n+\n+    // map 2MB memory for this emulation\n+    err = uc_mem_map(uc, address, 2 * 1024 * 1024, UC_PROT_ALL);\n+    uc_assert_success(err);\n+\n+    // write machine code to be emulated to memory\n+    err = uc_mem_write(uc, address, code, sizeof(code));\n+    uc_assert_success(err);\n+\n+    // hook interrupts for syscall\n+    err = uc_hook_add(uc, &trace1, UC_HOOK_BLOCK, hook_empty_bb, NULL);","path":"tests/unit/test_x86.c","position":42,"original_position":42,"commit_id":"0e094e31aad05de4fd8d22a518846969004ff1de","original_commit_id":"0e094e31aad05de4fd8d22a518846969004ff1de","user":{"login":"aquynh","id":5965536,"avatar_url":"https://avatars.githubusercontent.com/u/5965536?v=3","gravatar_id":"","url":"https://api.github.com/users/aquynh","html_url":"https://github.com/aquynh","followers_url":"https://api.github.com/users/aquynh/followers","following_url":"https://api.github.com/users/aquynh/following{/other_user}","gists_url":"https://api.github.com/users/aquynh/gists{/gist_id}","starred_url":"https://api.github.com/users/aquynh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aquynh/subscriptions","organizations_url":"https://api.github.com/users/aquynh/orgs","repos_url":"https://api.github.com/users/aquynh/repos","events_url":"https://api.github.com/users/aquynh/events{/privacy}","received_events_url":"https://api.github.com/users/aquynh/received_events","type":"User","site_admin":false},"body":"the recent change on API requires begin & end arguments. if you want to hook every block, then set begin > end, for example:\r\n\r\nerr = uc_hook_add(uc, &trace1, UC_HOOK_BLOCK, hook_empty_bb, NULL, (uint64_t)1, (uint64_t)0);","created_at":"2016-02-02T15:36:32Z","updated_at":"2016-02-02T15:36:32Z","html_url":"https://github.com/unicorn-engine/unicorn/pull/413#discussion_r51584419","pull_request_url":"https://api.github.com/repos/unicorn-engine/unicorn/pulls/413","_links":{"self":{"href":"https://api.github.com/repos/unicorn-engine/unicorn/pulls/comments/51584419"},"html":{"href":"https://github.com/unicorn-engine/unicorn/pull/413#discussion_r51584419"},"pull_request":{"href":"https://api.github.com/repos/unicorn-engine/unicorn/pulls/413"}}},"pull_request":{"url":"https://api.github.com/repos/unicorn-engine/unicorn/pulls/413","id":57972842,"html_url":"https://github.com/unicorn-engine/unicorn/pull/413","diff_url":"https://github.com/unicorn-engine/unicorn/pull/413.diff","patch_url":"https://github.com/unicorn-engine/unicorn/pull/413.patch","issue_url":"https://api.github.com/repos/unicorn-engine/unicorn/issues/413","number":413,"state":"open","locked":false,"title":"added testcase for zero length bb events","user":{"login":"eqv","id":3338793,"avatar_url":"https://avatars.githubusercontent.com/u/3338793?v=3","gravatar_id":"","url":"https://api.github.com/users/eqv","html_url":"https://github.com/eqv","followers_url":"https://api.github.com/users/eqv/followers","following_url":"https://api.github.com/users/eqv/following{/other_user}","gists_url":"https://api.github.com/users/eqv/gists{/gist_id}","starred_url":"https://api.github.com/users/eqv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eqv/subscriptions","organizations_url":"https://api.github.com/users/eqv/orgs","repos_url":"https://api.github.com/users/eqv/repos","events_url":"https://api.github.com/users/eqv/events{/privacy}","received_events_url":"https://api.github.com/users/eqv/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-02T11:19:04Z","updated_at":"2016-02-02T15:36:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0823ce577f29a69556ef01c45988d087162043d6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/unicorn-engine/unicorn/pulls/413/commits","review_comments_url":"https://api.github.com/repos/unicorn-engine/unicorn/pulls/413/comments","review_comment_url":"https://api.github.com/repos/unicorn-engine/unicorn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/unicorn-engine/unicorn/issues/413/comments","statuses_url":"https://api.github.com/repos/unicorn-engine/unicorn/statuses/0e094e31aad05de4fd8d22a518846969004ff1de","head":{"label":"eqv:test_empty_bb","ref":"test_empty_bb","sha":"0e094e31aad05de4fd8d22a518846969004ff1de","user":{"login":"eqv","id":3338793,"avatar_url":"https://avatars.githubusercontent.com/u/3338793?v=3","gravatar_id":"","url":"https://api.github.com/users/eqv","html_url":"https://github.com/eqv","followers_url":"https://api.github.com/users/eqv/followers","following_url":"https://api.github.com/users/eqv/following{/other_user}","gists_url":"https://api.github.com/users/eqv/gists{/gist_id}","starred_url":"https://api.github.com/users/eqv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eqv/subscriptions","organizations_url":"https://api.github.com/users/eqv/orgs","repos_url":"https://api.github.com/users/eqv/repos","events_url":"https://api.github.com/users/eqv/events{/privacy}","received_events_url":"https://api.github.com/users/eqv/received_events","type":"User","site_admin":false},"repo":{"id":44475069,"name":"unicorn","full_name":"eqv/unicorn","owner":{"login":"eqv","id":3338793,"avatar_url":"https://avatars.githubusercontent.com/u/3338793?v=3","gravatar_id":"","url":"https://api.github.com/users/eqv","html_url":"https://github.com/eqv","followers_url":"https://api.github.com/users/eqv/followers","following_url":"https://api.github.com/users/eqv/following{/other_user}","gists_url":"https://api.github.com/users/eqv/gists{/gist_id}","starred_url":"https://api.github.com/users/eqv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eqv/subscriptions","organizations_url":"https://api.github.com/users/eqv/orgs","repos_url":"https://api.github.com/users/eqv/repos","events_url":"https://api.github.com/users/eqv/events{/privacy}","received_events_url":"https://api.github.com/users/eqv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/eqv/unicorn","description":"Unicorn CPU emulator engine","fork":true,"url":"https://api.github.com/repos/eqv/unicorn","forks_url":"https://api.github.com/repos/eqv/unicorn/forks","keys_url":"https://api.github.com/repos/eqv/unicorn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eqv/unicorn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eqv/unicorn/teams","hooks_url":"https://api.github.com/repos/eqv/unicorn/hooks","issue_events_url":"https://api.github.com/repos/eqv/unicorn/issues/events{/number}","events_url":"https://api.github.com/repos/eqv/unicorn/events","assignees_url":"https://api.github.com/repos/eqv/unicorn/assignees{/user}","branches_url":"https://api.github.com/repos/eqv/unicorn/branches{/branch}","tags_url":"https://api.github.com/repos/eqv/unicorn/tags","blobs_url":"https://api.github.com/repos/eqv/unicorn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eqv/unicorn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eqv/unicorn/git/refs{/sha}","trees_url":"https://api.github.com/repos/eqv/unicorn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eqv/unicorn/statuses/{sha}","languages_url":"https://api.github.com/repos/eqv/unicorn/languages","stargazers_url":"https://api.github.com/repos/eqv/unicorn/stargazers","contributors_url":"https://api.github.com/repos/eqv/unicorn/contributors","subscribers_url":"https://api.github.com/repos/eqv/unicorn/subscribers","subscription_url":"https://api.github.com/repos/eqv/unicorn/subscription","commits_url":"https://api.github.com/repos/eqv/unicorn/commits{/sha}","git_commits_url":"https://api.github.com/repos/eqv/unicorn/git/commits{/sha}","comments_url":"https://api.github.com/repos/eqv/unicorn/comments{/number}","issue_comment_url":"https://api.github.com/repos/eqv/unicorn/issues/comments{/number}","contents_url":"https://api.github.com/repos/eqv/unicorn/contents/{+path}","compare_url":"https://api.github.com/repos/eqv/unicorn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eqv/unicorn/merges","archive_url":"https://api.github.com/repos/eqv/unicorn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eqv/unicorn/downloads","issues_url":"https://api.github.com/repos/eqv/unicorn/issues{/number}","pulls_url":"https://api.github.com/repos/eqv/unicorn/pulls{/number}","milestones_url":"https://api.github.com/repos/eqv/unicorn/milestones{/number}","notifications_url":"https://api.github.com/repos/eqv/unicorn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eqv/unicorn/labels{/name}","releases_url":"https://api.github.com/repos/eqv/unicorn/releases{/id}","deployments_url":"https://api.github.com/repos/eqv/unicorn/deployments","created_at":"2015-10-18T11:12:00Z","updated_at":"2015-10-18T11:12:03Z","pushed_at":"2016-02-02T11:18:35Z","git_url":"git://github.com/eqv/unicorn.git","ssh_url":"git@github.com:eqv/unicorn.git","clone_url":"https://github.com/eqv/unicorn.git","svn_url":"https://github.com/eqv/unicorn","homepage":"http://www.unicorn-engine.org","size":4618,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"unicorn-engine:master","ref":"master","sha":"dad2baa92f2306eab4b69537f06283595ee819b4","user":{"login":"unicorn-engine","id":13391512,"avatar_url":"https://avatars.githubusercontent.com/u/13391512?v=3","gravatar_id":"","url":"https://api.github.com/users/unicorn-engine","html_url":"https://github.com/unicorn-engine","followers_url":"https://api.github.com/users/unicorn-engine/followers","following_url":"https://api.github.com/users/unicorn-engine/following{/other_user}","gists_url":"https://api.github.com/users/unicorn-engine/gists{/gist_id}","starred_url":"https://api.github.com/users/unicorn-engine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unicorn-engine/subscriptions","organizations_url":"https://api.github.com/users/unicorn-engine/orgs","repos_url":"https://api.github.com/users/unicorn-engine/repos","events_url":"https://api.github.com/users/unicorn-engine/events{/privacy}","received_events_url":"https://api.github.com/users/unicorn-engine/received_events","type":"Organization","site_admin":false},"repo":{"id":41107037,"name":"unicorn","full_name":"unicorn-engine/unicorn","owner":{"login":"unicorn-engine","id":13391512,"avatar_url":"https://avatars.githubusercontent.com/u/13391512?v=3","gravatar_id":"","url":"https://api.github.com/users/unicorn-engine","html_url":"https://github.com/unicorn-engine","followers_url":"https://api.github.com/users/unicorn-engine/followers","following_url":"https://api.github.com/users/unicorn-engine/following{/other_user}","gists_url":"https://api.github.com/users/unicorn-engine/gists{/gist_id}","starred_url":"https://api.github.com/users/unicorn-engine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unicorn-engine/subscriptions","organizations_url":"https://api.github.com/users/unicorn-engine/orgs","repos_url":"https://api.github.com/users/unicorn-engine/repos","events_url":"https://api.github.com/users/unicorn-engine/events{/privacy}","received_events_url":"https://api.github.com/users/unicorn-engine/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/unicorn-engine/unicorn","description":"Unicorn CPU emulator engine","fork":false,"url":"https://api.github.com/repos/unicorn-engine/unicorn","forks_url":"https://api.github.com/repos/unicorn-engine/unicorn/forks","keys_url":"https://api.github.com/repos/unicorn-engine/unicorn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unicorn-engine/unicorn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unicorn-engine/unicorn/teams","hooks_url":"https://api.github.com/repos/unicorn-engine/unicorn/hooks","issue_events_url":"https://api.github.com/repos/unicorn-engine/unicorn/issues/events{/number}","events_url":"https://api.github.com/repos/unicorn-engine/unicorn/events","assignees_url":"https://api.github.com/repos/unicorn-engine/unicorn/assignees{/user}","branches_url":"https://api.github.com/repos/unicorn-engine/unicorn/branches{/branch}","tags_url":"https://api.github.com/repos/unicorn-engine/unicorn/tags","blobs_url":"https://api.github.com/repos/unicorn-engine/unicorn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unicorn-engine/unicorn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unicorn-engine/unicorn/git/refs{/sha}","trees_url":"https://api.github.com/repos/unicorn-engine/unicorn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unicorn-engine/unicorn/statuses/{sha}","languages_url":"https://api.github.com/repos/unicorn-engine/unicorn/languages","stargazers_url":"https://api.github.com/repos/unicorn-engine/unicorn/stargazers","contributors_url":"https://api.github.com/repos/unicorn-engine/unicorn/contributors","subscribers_url":"https://api.github.com/repos/unicorn-engine/unicorn/subscribers","subscription_url":"https://api.github.com/repos/unicorn-engine/unicorn/subscription","commits_url":"https://api.github.com/repos/unicorn-engine/unicorn/commits{/sha}","git_commits_url":"https://api.github.com/repos/unicorn-engine/unicorn/git/commits{/sha}","comments_url":"https://api.github.com/repos/unicorn-engine/unicorn/comments{/number}","issue_comment_url":"https://api.github.com/repos/unicorn-engine/unicorn/issues/comments{/number}","contents_url":"https://api.github.com/repos/unicorn-engine/unicorn/contents/{+path}","compare_url":"https://api.github.com/repos/unicorn-engine/unicorn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unicorn-engine/unicorn/merges","archive_url":"https://api.github.com/repos/unicorn-engine/unicorn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unicorn-engine/unicorn/downloads","issues_url":"https://api.github.com/repos/unicorn-engine/unicorn/issues{/number}","pulls_url":"https://api.github.com/repos/unicorn-engine/unicorn/pulls{/number}","milestones_url":"https://api.github.com/repos/unicorn-engine/unicorn/milestones{/number}","notifications_url":"https://api.github.com/repos/unicorn-engine/unicorn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unicorn-engine/unicorn/labels{/name}","releases_url":"https://api.github.com/repos/unicorn-engine/unicorn/releases{/id}","deployments_url":"https://api.github.com/repos/unicorn-engine/unicorn/deployments","created_at":"2015-08-20T16:35:45Z","updated_at":"2016-02-01T06:26:57Z","pushed_at":"2016-02-02T11:19:05Z","git_url":"git://github.com/unicorn-engine/unicorn.git","ssh_url":"git@github.com:unicorn-engine/unicorn.git","clone_url":"https://github.com/unicorn-engine/unicorn.git","svn_url":"https://github.com/unicorn-engine/unicorn","homepage":"http://www.unicorn-engine.org","size":4674,"stargazers_count":482,"watchers_count":482,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":84,"mirror_url":null,"open_issues_count":85,"forks":84,"open_issues":85,"watchers":482,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/unicorn-engine/unicorn/pulls/413"},"html":{"href":"https://github.com/unicorn-engine/unicorn/pull/413"},"issue":{"href":"https://api.github.com/repos/unicorn-engine/unicorn/issues/413"},"comments":{"href":"https://api.github.com/repos/unicorn-engine/unicorn/issues/413/comments"},"review_comments":{"href":"https://api.github.com/repos/unicorn-engine/unicorn/pulls/413/comments"},"review_comment":{"href":"https://api.github.com/repos/unicorn-engine/unicorn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/unicorn-engine/unicorn/pulls/413/commits"},"statuses":{"href":"https://api.github.com/repos/unicorn-engine/unicorn/statuses/0e094e31aad05de4fd8d22a518846969004ff1de"}}}}