Skip to content

Commit

Permalink
Make the message for tainted offsets more general
Browse files Browse the repository at this point in the history
  • Loading branch information
NagyDonat committed Nov 7, 2023
1 parent 64c5ffe commit 979a387
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static std::string getTaintMsg(std::string RegName) {
SmallString<128> Buf;
llvm::raw_svector_ostream Out(Buf);
Out << "Access of " << RegName
<< " with a tainted offset that may be too large";
<< " with a tainted offset that may be out of bounds";
return std::string(Buf);
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/out-of-bounds-diagnostics.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void taintedIndex(void) {
// expected-note@-2 {{Taint propagated to the 2nd argument}}
array[index] = 5;
// expected-warning@-1 {{Potential out of bound access to 'array' with tainted offset}}
// expected-note@-2 {{Access of 'array' with a tainted offset that may be too large}}
// expected-note@-2 {{Access of 'array' with a tainted offset that may be out of bounds}}
}

void arrayOverflow(void) {
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Analysis/taint-diagnostic-visitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int taintDiagnosticOutOfBound(void) {
scanf("%d", &index); // expected-note {{Taint originated here}}
// expected-note@-1 {{Taint propagated to the 2nd argument}}
return Array[index]; // expected-warning {{Potential out of bound access to 'Array' with tainted offset}}
// expected-note@-1 {{Access of 'Array' with a tainted offset that may be too large}}
// expected-note@-1 {{Access of 'Array' with a tainted offset that may be out of bounds}}
}

int taintDiagnosticDivZero(int operand) {
Expand Down

0 comments on commit 979a387

Please sign in to comment.