Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cfg/std.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4861,7 +4861,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
<noreturn>false</noreturn>
<not-overlapping-data ptr1-arg="1" ptr2-arg="2" strlen-arg="2"/>
<leak-ignore/>
<arg nr="1" direction="out">
<arg nr="1" direction="out" indirect="1">
<not-null/>
<minsize type="strlen" arg="2"/>
</arg>
Expand Down
4 changes: 0 additions & 4 deletions lib/astutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2516,10 +2516,6 @@ bool isVariableChangedByFunctionCall(const Token *tok, int indirect, const Setti
}
if (Token::simpleMatch(tok->tokAt(-2), "std :: tie"))
return true;
// if the library says 0 is invalid
// => it is assumed that parameter is an in parameter (TODO: this is a bad heuristic)
if (indirect == 0 && requireNonNull)
return false;
// possible pass-by-reference => inconclusive
if (possiblyPassedByReference) {
if (inconclusive != nullptr)
Expand Down
4 changes: 4 additions & 0 deletions lib/library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,10 @@ Library::Error Library::loadFunction(const tinyxml2::XMLElement * const node, co
if (const char* const argIndirect = functionnode->Attribute("indirect")) {
const int indirect = strToInt<int>(argIndirect);
ac.direction[indirect] = dir; // TODO: handle multiple directions/indirect levels
if (dir == ArgumentChecks::Direction::DIR_OUT) {
for (int i = 0; i < indirect; ++i)
ac.direction[i] = ArgumentChecks::Direction::DIR_IN; // ptr is not modified if pointed-to data are written
}
}
else
ac.direction.fill(dir);
Expand Down
1 change: 0 additions & 1 deletion test/cfg/std.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@ void bufferAccessOutOfBounds_std_ofstream_write(std::ofstream &os, const char* s
(void)os.write(s,n);
}

// cppcheck-suppress constParameterReference // TODO: FP
void bufferAccessOutOfBounds_std_ifstream_get(std::ifstream& in, std::streambuf& sb)
{
char cBuf[10];
Expand Down