The following issues were found

src/google/protobuf/util/time_util.cc
1 issues
StrCat - Does not check for buffer overflows when concatenating to destination [MS-banned]
Security

Line: 189 Column: 13 CWE codes: 120

                  seconds = -seconds;
    nanos = -nanos;
  }
  result += StrCat(seconds);
  if (nanos != 0) {
    result += "." + FormatNanos(nanos);
  }
  result += "s";
  return result;

            

Reported by FlawFinder.

src/google/protobuf/compiler/java/java_message_builder_lite.cc
1 issues
StrCat - Does not check for buffer overflows when concatenating to destination [MS-banned]
Security

Line: 100 Column: 27 CWE codes: 120

                  vars["oneof_name"] = context_->GetOneofGeneratorInfo(oneof)->name;
    vars["oneof_capitalized_name"] =
        context_->GetOneofGeneratorInfo(oneof)->capitalized_name;
    vars["oneof_index"] = StrCat(oneof->index());

    // oneofCase() and clearOneof()
    printer->Print(vars,
                   "@java.lang.Override\n"
                   "public $oneof_capitalized_name$Case\n"

            

Reported by FlawFinder.

src/google/protobuf/source_context.pb.cc
1 issues
There is an unknown macro here somewhere. Configuration is required. If PROTOBUF_NAMESPACE_OPEN is a macro then please configure it.
Error

Line: 276

              
// @@protoc_insertion_point(namespace_scope)
PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::SourceContext* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::SourceContext >(Arena* arena) {
  return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::SourceContext >(arena);
}
PROTOBUF_NAMESPACE_CLOSE


            

Reported by Cppcheck.

src/google/protobuf/struct.pb.cc
1 issues
There is an unknown macro here somewhere. Configuration is required. If PROTOBUF_NAMESPACE_OPEN is a macro then please configure it.
Error

Line: 1032

              
// @@protoc_insertion_point(namespace_scope)
PROTOBUF_NAMESPACE_CLOSE
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse >(Arena* arena) {
  return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse >(arena);
}
template<> PROTOBUF_NOINLINE ::PROTOBUF_NAMESPACE_ID::Struct* Arena::CreateMaybeMessage< ::PROTOBUF_NAMESPACE_ID::Struct >(Arena* arena) {
  return Arena::CreateMessageInternal< ::PROTOBUF_NAMESPACE_ID::Struct >(arena);

            

Reported by Cppcheck.

src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
1 issues
StrCat - Does not check for buffer overflows when concatenating to destination [MS-banned]
Security

Line: 218 Column: 21 CWE codes: 120

                } else {
    printer->Print(
      "size += $tag_size$ + $fixed_size$;\n",
      "fixed_size", StrCat(fixedSize),
      "tag_size", variables_["tag_size"]);
  }
  printer->Outdent();
  printer->Print("}\n");
}

            

Reported by FlawFinder.

src/google/protobuf/stubs/bytestream_unittest.cc
1 issues
syntax error
Error

Line: 64

                int block_size_;
};

TEST(ByteSourceTest, CopyTo) {
  StringPiece data("Hello world!");
  MockByteSource source(data, 3);
  std::string str;
  StringByteSink sink(&str);


            

Reported by Cppcheck.

src/google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc
1 issues
syntax error
Error

Line: 130

                std::string parameter_;
};

TEST(CsharpBootstrapTest, GeneratedCsharpDescriptorMatches) {
  // Skip this whole test if the csharp directory doesn't exist (i.e., a C++11
  // only distribution).
  std::string descriptor_file_name =
      "../csharp/src/Google.Protobuf/Reflection/Descriptor.cs";
  if (!File::Exists(TestSourceDir() + "/" + descriptor_file_name)) {

            

Reported by Cppcheck.

src/google/protobuf/stubs/common_unittest.cc
1 issues
syntax error
Error

Line: 89

                    implicit_cast<int>(level), filename, line, message));
}

TEST(LoggingTest, DefaultLogging) {
  CaptureTestStderr();
  int line = __LINE__;
  GOOGLE_LOG(INFO   ) << "A message.";
  GOOGLE_LOG(WARNING) << "A warning.";
  GOOGLE_LOG(ERROR  ) << "An error.";

            

Reported by Cppcheck.

src/google/protobuf/stubs/int128_unittest.cc
1 issues
syntax error
Error

Line: 180

                GOOGLE_LOG(INFO) << big_minus_one;
}

TEST(Int128, PodTests) {
  uint128_pod pod = { 12345, 67890 };
  uint128 from_pod(pod);
  EXPECT_EQ(12345, Uint128High64(from_pod));
  EXPECT_EQ(67890, Uint128Low64(from_pod));


            

Reported by Cppcheck.

src/google/protobuf/util/time_util_test.cc
1 issues
syntax error
Error

Line: 92

                EXPECT_EQ(8 * 3600, TimeUtil::TimestampToSeconds(time));
}

TEST(TimeUtilTest, DurationStringFormat) {
  Timestamp begin, end;
  EXPECT_TRUE(TimeUtil::FromString("0001-01-01T00:00:00Z", &begin));
  EXPECT_TRUE(TimeUtil::FromString("9999-12-31T23:59:59.999999999Z", &end));

  EXPECT_EQ("315537897599.999999999s", TimeUtil::ToString(end - begin));

            

Reported by Cppcheck.