1
0
Fork 0

DBG+GUI: fixed various @coverity issues

This commit is contained in:
mrexodia 2017-01-09 01:10:43 +01:00
parent 94b2280e59
commit 0767d74ef2
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
9 changed files with 10 additions and 21 deletions

View File

@ -1238,7 +1238,7 @@ extern "C" DLL_EXPORT duint _dbg_sendmessage(DBGMSG type, void* param1, void* pa
{
if(disasmgetstringat(addrPtr, &strtype, string, string, MAX_STRING_SIZE - 5))
{
if(int(strlen(string)) <= strtype == str_ascii ? 3 : 2 && readValidPtr(addrPtr))
if(int(strlen(string)) <= (strtype == str_ascii ? 3 : 2) && readValidPtr(addrPtr))
return false;
if(strtype == str_ascii)
sprintf_s(dest, MAX_STRING_SIZE, "&\"%s\"", string);

@ -1 +1 @@
Subproject commit 46b59b43ceb0209d7ab46d7f69bd16003b40b5a9
Subproject commit 90eed9913a12ef5afec007b4d91f77301b66cc76

View File

@ -4,11 +4,7 @@ static JSON_INLINE
json_t* json_hex(unsigned json_int_t value)
{
char hexvalue[20];
#ifdef _WIN64
sprintf(hexvalue, "0x%llX", value);
#else //x64
sprintf(hexvalue, "0x%X", value);
#endif //_WIN64
return json_string(hexvalue);
}
@ -20,10 +16,6 @@ unsigned json_int_t json_hex_value(const json_t* hex)
hexvalue = json_string_value(hex);
if(!hexvalue)
return 0;
#ifdef _WIN64
sscanf(hexvalue, "0x%llX", &ret);
#else //x64
sscanf(hexvalue, "0x%X", &ret);
#endif //_WIN64
return ret;
}

View File

@ -54,7 +54,7 @@ static void getSymAddrName(duint addr, char* str)
if(addrinfo.module[0] != '\0')
sprintf_s(str, MAX_COMMENT_SIZE, "%s.", addrinfo.module);
if(addrinfo.label[0] == '\0')
sprintf_s(addrinfo.label, MAX_COMMENT_SIZE, "%p", addr);
sprintf_s(addrinfo.label, "%p", addr);
strcat_s(str, MAX_COMMENT_SIZE, addrinfo.label);
}

View File

@ -37,7 +37,7 @@ bool SymbolAdd(const SymbolInfo & symbol)
{
EXCLUSIVE_ACQUIRE(LockSymbolCache);
auto foundR = symbolRange.find(Range(symbol.addr, symbol.addr));
if(foundR != symbolRange.end())
if(foundR == symbolRange.end())
return false;
auto foundS = foundR->second.find(Range(symbol.addr, symbol.addr));
if(foundS != foundR->second.end())
@ -101,7 +101,7 @@ bool LineAdd(const LineInfo & line)
{
EXCLUSIVE_ACQUIRE(LockLineCache);
auto foundR = lineRange.find(Range(line.addr, line.addr));
if(foundR != lineRange.end())
if(foundR == lineRange.end())
return false;
auto foundL = foundR->second.find(Range(line.addr, line.addr));
if(foundL != foundR->second.end())

View File

@ -231,9 +231,6 @@ bool ParseTypes(const std::string & parse, const std::string & owner)
dputs("invalid struct token sequence!");
return false;
}
errLine();
dprintf("not enough tokens for %s\n", su.isunion ? "union" : "struct");
return false;
}
return true;
};

View File

@ -6,7 +6,8 @@
CapstoneTokenizer::CapstoneTokenizer(int maxModuleLength)
: _maxModuleLength(maxModuleLength),
_success(false),
isNop(false)
isNop(false),
_mnemonicType(TokenType::Uncategorized)
{
SetConfig(false, false, false, false, false);
}

View File

@ -3,7 +3,8 @@
#include "Bridge.h"
BreakpointsViewTable::BreakpointsViewTable(QWidget* parent)
: StdTable(parent)
: StdTable(parent),
mCip(0)
{
updateColors();
connect(Bridge::getBridge(), SIGNAL(disassembleAt(dsint, dsint)), this, SLOT(disassembleAtSlot(dsint, dsint)));

View File

@ -251,8 +251,6 @@ private:
struct WidgetInfo
{
public:
WidgetInfo() { }
WidgetInfo(QWidget* widget, QString nativeName)
{
this->widget = widget;
@ -263,7 +261,7 @@ private:
QString nativeName;
};
QVector<WidgetInfo> mWidgetList;
QList<WidgetInfo> mWidgetList;
protected:
void dragEnterEvent(QDragEnterEvent* pEvent);