Merge pull request #852 from boos/cwe-mapping-16

CWE mapping of accessMoved, accessForwarded, nullPointerArithmeticRedundantCheck, nullPointerArithmetic
This commit is contained in:
Daniel Marjamäki 2016-12-25 22:45:08 +01:00 committed by GitHub
commit c8bc1c8f0e
2 changed files with 4 additions and 2 deletions

View File

@ -31,6 +31,7 @@ namespace {
}
static const CWE CWE476(476U); // NULL Pointer Dereference
static const CWE CWE682(682U); // Incorrect Calculation
//---------------------------------------------------------------------------
@ -538,7 +539,7 @@ void CheckNullPointer::arithmeticError(const Token *tok, const ValueFlow::Value
(value && value->condition) ? Severity::warning : Severity::error,
(value && value->condition) ? "nullPointerArithmeticRedundantCheck" : "nullPointerArithmetic",
errmsg,
CWE(0), // unknown - pointer overflow
CWE682, // unknown - pointer overflow
value && value->inconclusive);
}

View File

@ -45,6 +45,7 @@ static const struct CWE CWE561(561U); // Dead Code
static const struct CWE CWE563(563U); // Assignment to Variable without Use ('Unused Variable')
static const struct CWE CWE570(570U); // Expression is Always False
static const struct CWE CWE571(571U); // Expression is Always True
static const struct CWE CWE672(672U); // Operation on a Resource after Expiration or Release
static const struct CWE CWE686(686U); // Function Call With Incorrect Argument Type
static const struct CWE CWE687(687U); // Function Call With Incorrectly Specified Argument Value
static const struct CWE CWE688(688U); // Function Call With Incorrect Variable or Reference as Argument
@ -2768,6 +2769,6 @@ void CheckOther::accessMovedError(const Token *tok, const std::string &varname,
return;
}
const std::string errmsg(std::string("Access of ") + kindString + " variable " + varname + ".");
reportError(tok, Severity::warning, errorId, errmsg, CWE(0U), inconclusive);
reportError(tok, Severity::warning, errorId, errmsg, CWE672, inconclusive);
}