Don't interpret data as code in xrefs from table. (#1710)

This commit is contained in:
karliss 2019-08-11 21:42:15 +03:00 committed by Itay Cohen
parent a5fbbee571
commit 468100c52d

View File

@ -41,7 +41,9 @@ void XrefsDialog::fillRefs(QList<XrefDescription> refs, QList<XrefDescription> x
for (const auto &xref : refs) { for (const auto &xref : refs) {
auto *tempItem = new QTreeWidgetItem(); auto *tempItem = new QTreeWidgetItem();
tempItem->setText(0, xref.to_str); tempItem->setText(0, xref.to_str);
if (xref.type != "DATA") {
tempItem->setText(1, Core()->disassembleSingleInstruction(xref.to)); tempItem->setText(1, Core()->disassembleSingleInstruction(xref.to));
}
tempItem->setText(2, xrefTypeString(xref.type)); tempItem->setText(2, xrefTypeString(xref.type));
tempItem->setData(0, Qt::UserRole, QVariant::fromValue(xref)); tempItem->setData(0, Qt::UserRole, QVariant::fromValue(xref));
ui->fromTreeWidget->insertTopLevelItem(0, tempItem); ui->fromTreeWidget->insertTopLevelItem(0, tempItem);
@ -187,19 +189,14 @@ void XrefsDialog::fillRefsForAddress(RVA addr, QString name, bool whole_function
QString XrefsDialog::xrefTypeString(const QString &type) QString XrefsDialog::xrefTypeString(const QString &type)
{ {
switch (type.toStdString()[0]) { if (type == "CODE") {
case R_ANAL_REF_TYPE_CALL:
return QString("Call");
case R_ANAL_REF_TYPE_CODE:
return QString("Code"); return QString("Code");
case R_ANAL_REF_TYPE_DATA: } else if (type == "CALL") {
return QString("Call");
} else if (type == "DATA") {
return QString("Data"); return QString("Data");
case R_ANAL_REF_TYPE_NULL: } else if (type == "STRING") {
return QString();
case R_ANAL_REF_TYPE_STRING:
return QString("String"); return QString("String");
default:
break;
} }
return type; return type;
} }