Fixed Coverity 'High Impact Outstanding' issues:

CIDs in main code:
1446691
1446688 (false positive)
1446672 (false positive)
1446643
1446642
1446641
1446635 (false positive)

CIDs in debugger:
1472410
1446728 (false positive)
1446684
1446673
1472409
1446693
1446692
1446726
1446687
1446685
1446683
This commit is contained in:
tomcw
2018-11-06 19:12:10 +00:00
parent 3bf94eca9d
commit f9b7d9326e
9 changed files with 36 additions and 15 deletions
+16 -9
View File
@@ -3639,7 +3639,7 @@ Update_t CmdFlagClear (int nArgs)
{
int iFlag = (g_iCommand - CMD_FLAG_CLR_C);
if (g_iCommand == CMD_FLAG_CLEAR)
if (g_iCommand == CMD_FLAG_CLEAR) // Undocumented: "cl f f ... f", eg: "se n v c" (TODO: Conflicts with monitor command #L -> 000CL)
{
int iArg = nArgs;
while (iArg)
@@ -3648,9 +3648,10 @@ Update_t CmdFlagClear (int nArgs)
while (iFlag < _6502_NUM_FLAGS)
{
// if (g_aFlagNames[iFlag] == g_aArgs[iArg].sArg[0])
if (g_aBreakpointSource[ BP_SRC_FLAG_N + iFlag ][0] == g_aArgs[iArg].sArg[0])
if (g_aBreakpointSource[ BP_SRC_FLAG_N - iFlag ][0] == toupper(g_aArgs[iArg].sArg[0]))
{
regs.ps &= ~(1 << iFlag);
regs.ps &= ~(1 << (7-iFlag));
break;
}
iFlag++;
}
@@ -3670,7 +3671,7 @@ Update_t CmdFlagSet (int nArgs)
{
int iFlag = (g_iCommand - CMD_FLAG_SET_C);
if (g_iCommand == CMD_FLAG_SET)
if (g_iCommand == CMD_FLAG_SET) // Undocumented: "se f f ... f", eg: "se n v c"
{
int iArg = nArgs;
while (iArg)
@@ -3679,9 +3680,10 @@ Update_t CmdFlagSet (int nArgs)
while (iFlag < _6502_NUM_FLAGS)
{
// if (g_aFlagNames[iFlag] == g_aArgs[iArg].sArg[0])
if (g_aBreakpointSource[ BP_SRC_FLAG_N + iFlag ][0] == g_aArgs[iArg].sArg[0])
if (g_aBreakpointSource[ BP_SRC_FLAG_N - iFlag ][0] == toupper(g_aArgs[iArg].sArg[0]))
{
regs.ps |= (1 << iFlag);
regs.ps |= (1 << (7-iFlag));
break;
}
iFlag++;
}
@@ -4151,8 +4153,12 @@ Update_t CmdConfigSetDebugDir (int nArgs)
{
_tcsncpy( sPath, g_sCurrentDir, 2 ); // Prefix with drive letter & colon
sPath[2] = 0;
_tcscat( sPath, g_aArgs[1].sArg );
}
else
{
_tcscpy( sPath, g_aArgs[1].sArg );
}
_tcscat( sPath, g_aArgs[1].sArg );
}
else // Relative
{
@@ -6454,7 +6460,8 @@ Update_t CmdOutputRun (int nArgs)
// if (g_aArgs[1].bType & TYPE_QUOTED_2)
_tcscpy( sMiniFileName, pFileName );
_tcsncpy( sMiniFileName, pFileName, sizeof(sMiniFileName) );
sMiniFileName[sizeof(sMiniFileName)-1] = 0;
// _tcscat( sMiniFileName, ".aws" ); // HACK: MAGIC STRING
if (pFileName[0] == '\\' || pFileName[1] == ':') // NB. Any prefix quote has already been stripped
@@ -7616,7 +7623,7 @@ Update_t CmdZeroPagePointer (int nArgs)
// int nPtrNum = g_aArgs[0].sArg[1] - '0'; // HACK: hard-coded to command length
int iZP = g_iCommand - CMD_ZEROPAGE_POINTER_0;
if( (iZP < 0) || (iZP > MAX_ZEROPAGE_POINTERS) )
if( (iZP < 0) || (iZP >= MAX_ZEROPAGE_POINTERS) )
return Help_Arg_1( g_iCommand );
if (nArgs == 0)