#6543 crash: CheckCondition::checkBadBitmaskCheck ; wine dlls/gdi32/dibdrv/primitives.c. Run astyle.

This commit is contained in:
Alexander Mai 2015-02-23 22:06:55 +01:00
parent fb5cc6fded
commit b9cc5b5c6b
2 changed files with 18 additions and 9 deletions

View File

@ -203,12 +203,12 @@ void CheckCondition::checkBadBitmaskCheck()
for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) {
if (tok->str() == "|" && tok->astOperand1() && tok->astOperand2() && tok->astParent()) {
bool isBoolean = Token::Match(tok->astParent(), "&&|%oror%") ||
const bool isBoolean = Token::Match(tok->astParent(), "&&|%oror%") ||
(tok->astParent()->str() == "?" && tok->astParent()->astOperand1() == tok) ||
(tok->astParent()->str() == "=" && tok->astParent()->astOperand2() == tok && tok->astParent()->astOperand1()->variable() && tok->astParent()->astOperand1()->variable()->typeStartToken()->str() == "bool") ||
(tok->astParent()->str() == "=" && tok->astParent()->astOperand2() == tok && tok->astParent()->astOperand1() && tok->astParent()->astOperand1()->variable() && tok->astParent()->astOperand1()->variable()->typeStartToken()->str() == "bool") ||
(tok->astParent()->str() == "(" && Token::Match(tok->astParent()->astOperand1(), "if|while"));
bool isTrue = (tok->astOperand1()->values.size() == 1 && tok->astOperand1()->values.front().intvalue != 0 && !tok->astOperand1()->values.front().conditional) ||
const bool isTrue = (tok->astOperand1()->values.size() == 1 && tok->astOperand1()->values.front().intvalue != 0 && !tok->astOperand1()->values.front().conditional) ||
(tok->astOperand2()->values.size() == 1 && tok->astOperand2()->values.front().intvalue != 0 && !tok->astOperand2()->values.front().conditional);
if (isBoolean && isTrue)

View File

@ -529,6 +529,15 @@ private:
" return x | 0x02;\n"
"}");
ASSERT_EQUALS("", errout.str());
check("void create_rop_masks_4( rop_mask_bits *bits) {\n"
"DWORD mask_offset;\n"
"BYTE *and_bits = bits->and;\n"
"rop_mask *rop_mask;\n"
"and_bits[mask_offset] |= (rop_mask->and & 0x0f);\n"
"}");
ASSERT_EQUALS("", errout.str());
}