From 979a38721cb3ebeda89b8a1bf6a39aaca2ed32e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Don=C3=A1t=20Nagy?= Date: Tue, 7 Nov 2023 13:13:40 +0100 Subject: [PATCH] Make the message for tainted offsets more general --- clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp | 2 +- clang/test/Analysis/out-of-bounds-diagnostics.c | 2 +- clang/test/Analysis/taint-diagnostic-visitor.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp index ffc7236d1e2551..7352df809f520b 100644 --- a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp @@ -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); } diff --git a/clang/test/Analysis/out-of-bounds-diagnostics.c b/clang/test/Analysis/out-of-bounds-diagnostics.c index 4f5d0d0bc91c54..ec2cce19a9e6f6 100644 --- a/clang/test/Analysis/out-of-bounds-diagnostics.c +++ b/clang/test/Analysis/out-of-bounds-diagnostics.c @@ -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) { diff --git a/clang/test/Analysis/taint-diagnostic-visitor.c b/clang/test/Analysis/taint-diagnostic-visitor.c index 67dc67e627b3b9..c3dd769088274a 100644 --- a/clang/test/Analysis/taint-diagnostic-visitor.c +++ b/clang/test/Analysis/taint-diagnostic-visitor.c @@ -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) {