Skip to content

Commit

Permalink
Suppress bogus coverity warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Oct 22, 2015
1 parent 869ed1e commit b64913b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions format.cc
Expand Up @@ -449,6 +449,7 @@ class BasicArgFormatter : public ArgVisitor<Impl, void> {
std::fill_n(out, spec_.width_ - 1, fill);
out += spec_.width_ - 1;
} else if (spec_.align_ == ALIGN_CENTER) {
// coverity[suspicious_sizeof]
out = writer_.fill_padding(out, spec_.width_, 1, fill);
} else {
std::fill_n(out + 1, spec_.width_ - 1, fill);
Expand Down
6 changes: 2 additions & 4 deletions test/gtest-extra-test.cc
Expand Up @@ -40,9 +40,6 @@

using testing::internal::scoped_ptr;

// Marks the argument as sanitized (defined in Coverity model file).
const std::string &sanitize(const std::string &s) { return s; }

namespace {

// Tests that assertion macros evaluate their arguments exactly once.
Expand Down Expand Up @@ -380,7 +377,8 @@ TEST(OutputRedirectTest, RestoreAndRead) {
std::fprintf(file.get(), "[[[");
OutputRedirect redir(file.get());
std::fprintf(file.get(), "censored");
EXPECT_EQ("censored", sanitize(redir.restore_and_read()));
// coverity[tainted_data]
EXPECT_EQ("censored", redir.restore_and_read());
EXPECT_EQ("", redir.restore_and_read());
std::fprintf(file.get(), "]]]");
file = BufferedFile();
Expand Down

0 comments on commit b64913b

Please sign in to comment.