The following issues were found
src/google/protobuf/util/internal/default_value_objectwriter_test.cc
1 issues
Line: 82
::testing::Values(
testing::USE_TYPE_RESOLVER));
TEST_P(DefaultValueObjectWriterTest, Empty) {
// Set expectation
expects_.StartObject("")
->RenderDouble("doubleValue", 0.0)
->StartList("repeatedDouble")
->EndList()
Reported by Cppcheck.
ruby/src/main/java/google/ProtobufJavaService.java
1 issues
Line: 35
package google;
import com.google.protobuf.jruby.*;
import org.jruby.Ruby;
import org.jruby.runtime.load.BasicLibraryService;
import java.io.IOException;
Reported by PMD.
python/google/protobuf/__init__.py
1 issues
Line: 1
Column: 1
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
Reported by Pylint.
conformance/conformance_cpp.cc
1 issues
Line: 83
Column: 26
CWE codes:
120
20
bool CheckedRead(int fd, void *buf, size_t len) {
size_t ofs = 0;
while (len > 0) {
ssize_t bytes_read = read(fd, (char*)buf + ofs, len);
if (bytes_read == 0) return false;
if (bytes_read < 0) {
GOOGLE_LOG(FATAL) << "Error reading from test runner: " << strerror(errno);
Reported by FlawFinder.
src/google/protobuf/util/internal/json_objectwriter_test.cc
1 issues
Line: 68
JsonObjectWriter* ow_;
};
TEST_F(JsonObjectWriterTest, EmptyRootObject) {
ow_ = new JsonObjectWriter("", out_stream_);
ow_->StartObject("")->EndObject();
EXPECT_EQ("{}", CloseStreamAndGetString());
}
Reported by Cppcheck.
ruby/ext/google/protobuf_c/wrap_memcpy.c
1 issues
Line: 44
Column: 12
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
#if defined(__x86_64__) && defined(__GNU_LIBRARY__)
__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
void *__wrap_memcpy(void *dest, const void *src, size_t n) {
return memcpy(dest, src, n);
}
#else
void *__wrap_memcpy(void *dest, const void *src, size_t n) {
return memmove(dest, src, n);
}
Reported by FlawFinder.
src/google/protobuf/util/internal/json_stream_parser_test.cc
1 issues
Line: 172
// Positive tests
// - true, false, null
TEST_F(JsonStreamParserTest, SimpleTrue) {
StringPiece str = "true";
for (int i = 0; i <= str.length(); ++i) {
ow_.RenderBool("", true);
DoTest(str, i);
}
Reported by Cppcheck.
java/core/src/main/java/com/google/protobuf/Parser.java
1 issues
Line: 47
*
* @author liujisi@google.com (Pherl Liu)
*/
public interface Parser<MessageType> {
// NB(jh): Other parts of the protobuf API that parse messages distinguish between an I/O problem
// (like failure reading bytes from a socket) and invalid data (encoding error) via the type of
// thrown exception. But it would be source-incompatible to make the methods in this interface do
// so since they were originally spec'ed to only throw InvalidProtocolBufferException. So callers
Reported by PMD.
java/core/src/main/java/com/google/protobuf/ProtobufLists.java
1 issues
Line: 42
/** Utility class for construction of lists that extend {@link ProtobufList}. */
@ExperimentalApi
final class ProtobufLists {
private ProtobufLists() {}
public static <E> ProtobufList<E> emptyProtobufList() {
return ProtobufArrayList.emptyList();
}
Reported by PMD.
python/google/protobuf/internal/import_test_package/__init__.py
1 issues
Line: 33
Column: 1
"""Sample module importing a nested proto from itself."""
from google.protobuf.internal.import_test_package import outer_pb2 as myproto
Reported by Pylint.