{"action":"opened","issue":{"url":"https://api.github.com/repos/aquynh/capstone/issues/497","labels_url":"https://api.github.com/repos/aquynh/capstone/issues/497/labels{/name}","comments_url":"https://api.github.com/repos/aquynh/capstone/issues/497/comments","events_url":"https://api.github.com/repos/aquynh/capstone/issues/497/events","html_url":"https://github.com/aquynh/capstone/issues/497","id":109686177,"number":497,"title":"Uninitialized memory reads in X86 Disassembler","user":{"login":"radare","id":917142,"avatar_url":"https://avatars.githubusercontent.com/u/917142?v=3","gravatar_id":"","url":"https://api.github.com/users/radare","html_url":"https://github.com/radare","followers_url":"https://api.github.com/users/radare/followers","following_url":"https://api.github.com/users/radare/following{/other_user}","gists_url":"https://api.github.com/users/radare/gists{/gist_id}","starred_url":"https://api.github.com/users/radare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radare/subscriptions","organizations_url":"https://api.github.com/users/radare/orgs","repos_url":"https://api.github.com/users/radare/repos","events_url":"https://api.github.com/users/radare/events{/privacy}","received_events_url":"https://api.github.com/users/radare/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-04T15:17:27Z","updated_at":"2015-10-04T15:17:27Z","closed_at":null,"body":"I have found that several instructions produce invalid memory reads in the prefix. This bug can be reproduced with an ASAN build or just with valgrind disassembling the  `rasm2 -a x86 -b64 -d ff0000` bytes. Here's a C test case:\r\n\r\n```\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <capstone/capstone.h>\r\n\r\n\r\nint main()\r\n{\r\n        int count;\r\n        static csh handle;\r\n        cs_insn *insn;\r\n        uint8_t fun[] = \"\\xff\\x00\\x00\";\r\n        cs_err err = cs_open(CS_ARCH_X86, CS_MODE_32, &handle);\r\n        if (err) {\r\n                printf(\"Failed on cs_open() with error returned: %u\\n\", err);\r\n                abort();\r\n        }\r\n\r\n        count = cs_disasm(handle, fun, 3, 0, 1, &insn);\r\n        printf (\"%d\\n\", count);\r\n        return 0;\r\n}\r\n```\r\n\r\nThe offending lines are in:\r\n\r\n* X86DisassemblerDecoder:370\r\n* X86DisassemblerDecoder:1220\r\n* X86Disassembler:124\r\n* X86Disassembler:100"}}