avoid crash in checkother:wrongPipeParameterSize when a pointer with unknown size is provided.
This commit is contained in:
parent
33cfc1a52e
commit
e03a3946d0
|
@ -524,7 +524,7 @@ void CheckOther::checkPipeParameterSize()
|
|||
|
||||
const Variable *var = varTok->variable();
|
||||
MathLib::bigint dim;
|
||||
if (var && (var->isArray() || var->isPointer()) && ((dim=var->dimension(0U)) < 2)) {
|
||||
if (var && (var->isArray() || var->isPointer()) && !var->isArgument() && ((dim=var->dimension(0U)) < 2)) {
|
||||
const std::string strDim = MathLib::longToString(dim);
|
||||
checkPipeParameterSizeError(varTok,varTok->str(), strDim);
|
||||
}
|
||||
|
|
|
@ -6114,6 +6114,15 @@ private:
|
|||
" }\n"
|
||||
"}",NULL,false,false,true);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// avoid crash with pointer variable
|
||||
check("void foo (int* arrayPtr)\n"
|
||||
"{\n"
|
||||
" if (pipe (arrayPtr) < 0)\n"
|
||||
" {}\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
}
|
||||
|
||||
void checkCastIntToCharAndBack() { // #160
|
||||
|
|
Loading…
Reference in New Issue