DBG+GUI: fixed various bugs found by coverity
This commit is contained in:
parent
c86eaa5a08
commit
047e45b44e
|
|
@ -96,8 +96,7 @@ static const char* regTable[] =
|
|||
SCRIPT_EXPORT duint Script::Register::Get(Script::Register::RegisterEnum reg)
|
||||
{
|
||||
duint value;
|
||||
valfromstring(regTable[reg], &value);
|
||||
return value;
|
||||
return valfromstring(regTable[reg], &value) ? value : 0;
|
||||
}
|
||||
|
||||
SCRIPT_EXPORT bool Script::Register::Set(Script::Register::RegisterEnum reg, duint value)
|
||||
|
|
|
|||
|
|
@ -71,8 +71,10 @@ void FunctionAnalysis::AnalyseFunctions()
|
|||
uint end = FindFunctionEnd(function.start, maxaddr);
|
||||
if(end)
|
||||
{
|
||||
_cp.Disassemble(end, TranslateAddress(end), MAX_DISASM_BUFFER);
|
||||
function.end = end + _cp.Size() - 1;
|
||||
if(_cp.Disassemble(end, TranslateAddress(end), MAX_DISASM_BUFFER))
|
||||
function.end = end + _cp.Size() - 1;
|
||||
else
|
||||
function.end = end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1511,7 +1511,7 @@ static bool cbFindAsm(Capstone* disasm, BASIC_INSTRUCTION_INFO* basicinfo, REFIN
|
|||
if(found)
|
||||
{
|
||||
char addrText[20] = "";
|
||||
sprintf(addrText, "%p", disasm->Address());
|
||||
sprintf(addrText, fhex, disasm->Address());
|
||||
GuiReferenceSetRowCount(refinfo->refcount + 1);
|
||||
GuiReferenceSetCellContent(refinfo->refcount, 0, addrText);
|
||||
char disassembly[GUI_MAX_DISASSEMBLY_SIZE] = "";
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ StdTable::StdTable(QWidget* parent) : AbstractTableView(parent)
|
|||
mSelection = data;
|
||||
|
||||
mIsMultiSelctionAllowed = false;
|
||||
mIsColumnSortingAllowed = true;
|
||||
|
||||
mData.clear();
|
||||
mSort.first = -1;
|
||||
|
|
|
|||
|
|
@ -483,7 +483,8 @@ QString CPUDump::paintContent(QPainter* painter, int_t rowBase, int rowOffset, i
|
|||
int_t wRva = (rowBase + rowOffset) * getBytePerRowCount() - mByteOffset;
|
||||
mMemPage->read((byte_t*)&data, wRva, sizeof(uint_t));
|
||||
char modname[MAX_MODULE_SIZE] = "";
|
||||
DbgGetModuleAt(data, modname);
|
||||
if(!DbgGetModuleAt(data, modname))
|
||||
modname[0] = '\0';
|
||||
char label_text[MAX_LABEL_SIZE] = "";
|
||||
if(DbgGetLabelAt(data, SEG_DEFAULT, label_text))
|
||||
wStr = QString(modname) + "." + QString(label_text);
|
||||
|
|
|
|||
|
|
@ -559,9 +559,11 @@ void PatchDialog::on_btnImport_clicked()
|
|||
unsigned char checkbyte = 0;
|
||||
DbgMemRead(curPatch.addr, &checkbyte, sizeof(checkbyte));
|
||||
IMPORTSTATUS status;
|
||||
if(status.alreadypatched = checkbyte == newbyte)
|
||||
status.alreadypatched = (checkbyte == newbyte);
|
||||
status.badoriginal = (checkbyte != oldbyte);
|
||||
if(status.alreadypatched)
|
||||
bAlreadyDone = true;
|
||||
else if(status.badoriginal = checkbyte != oldbyte)
|
||||
else if(status.badoriginal)
|
||||
bBadOriginal = true;
|
||||
curPatch.oldbyte = oldbyte;
|
||||
curPatch.newbyte = newbyte;
|
||||
|
|
|
|||
Loading…
Reference in New Issue