Skip to content

Commit

Permalink
GUI+DBG: issue #416 should be partially fixed now (mainly disassembling)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexodia committed Oct 29, 2015
1 parent 0cffb9d commit 81377dd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
4 changes: 1 addition & 3 deletions x64_dbg_dbg/capstone_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ bool Capstone::InGroup(cs_group_type group) const

std::string Capstone::OperandText(int opindex) const
{
if(!Success())
return false;
if(opindex >= mInstr->detail->x86.op_count)
if(!Success() || opindex >= mInstr->detail->x86.op_count)
return "";
const auto & op = mInstr->detail->x86.operands[opindex];
std::string result;
Expand Down
2 changes: 1 addition & 1 deletion x64_dbg_gui/Project/Src/Disassembler/capstone_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ bool CapstoneTokenizer::tokenizeMemOperand(const cs_x86_op & op)
//stuff inside the brackets
if(mem.base == X86_REG_RIP) //rip-relative (#replacement)
{
duint addr = _cp.Address() + duint (mem.disp);
duint addr = _cp.Address() + duint (mem.disp) + _cp.Size();
TokenValue value = TokenValue(op.size, addr);
auto displacementType = DbgMemIsValidReadPtr(addr) ? TokenType::Address : TokenType::Value;
addToken(displacementType, printValue(value, false, _maxModuleLength), value);
Expand Down
4 changes: 1 addition & 3 deletions x64_dbg_gui/Project/Src/Disassembler/capstone_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ bool Capstone::InGroup(cs_group_type group) const

std::string Capstone::OperandText(int opindex) const
{
if(!Success())
return false;
if(opindex >= mInstr->detail->x86.op_count)
if(!Success() || opindex >= mInstr->detail->x86.op_count)
return "";
const auto & op = mInstr->detail->x86.operands[opindex];
std::string result;
Expand Down

0 comments on commit 81377dd

Please sign in to comment.