Closed
Description
What version of protobuf and what language are you using?
Version: 4.25.0 (archlinux protobuf version 25.0-1) (absl version 20230802.1-1)
Language: C++
What operating system (Linux, Windows, ...) and version?
Linux (arch 6.6.1-arch1-1)
What runtime / compiler are you using (e.g., python version or gcc version)
gcc 13.2.1 20230801
clang 16.0.6
What did you do?
Steps to reproduce the behavior:
Example proto:
syntax = "proto3";
message Test {
int32 number = 1;
}
Example code:
#include <google/protobuf/message_lite.h>
#include <iostream>
#include "test.pb.h"
int main(){
GOOGLE_PROTOBUF_VERIFY_VERSION;
{
Test test;
test.set_number(1);
std::cout << "Test: " << test.DebugString() << std::endl;
}
google::protobuf::ShutdownProtobufLibrary();
return 0;
}
valgrind --leak-check=full ./test
What did you expect to see
No leak as with versions <=4.24
What did you see instead?
Error
==68934== HEAP SUMMARY:
==68934== in use at exit: 616 bytes in 14 blocks
==68934== total heap usage: 4,871 allocs, 4,857 frees, 378,264 bytes allocated
==68934==
==68934== 32 bytes in 1 blocks are possibly lost in loss record 1 of 6
==68934== at 0x4841FC3: operator new(unsigned long) (vg_replace_malloc.c:472)
==68934== by 0x4A7E8B0: UnknownInlinedFun (port.h:86)
==68934== by 0x4A7E8B0: UnknownInlinedFun (port.h:79)
==68934== by 0x4A7E8B0: google::protobuf::internal::RepeatedPtrFieldBase::InternalExtend(int) (repeated_ptr_field.cc:50)
==68934== by 0x4A7E945: google::protobuf::internal::RepeatedPtrFieldBase::AddOutOfLineHelper(void*) (repeated_ptr_field.cc:119)
==68934== by 0x4A0BD62: UnknownInlinedFun (repeated_ptr_field.h:236)
==68934== by 0x4A0BD62: UnknownInlinedFun (repeated_ptr_field.h:230)
==68934== by 0x4A0BD62: UnknownInlinedFun (generated_message_tctable_lite.cc:474)
==68934== by 0x4A0BD62: google::protobuf::internal::TcParser::FastMtR1(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcFieldData, google::protobuf::internal::TcParseTableBase const*, unsigned long) (generated_message_tctable_lite.cc:521)
==68934== by 0x4A0A19D: UnknownInlinedFun (generated_message_tctable_impl.h:922)
==68934== by 0x4A0A19D: google::protobuf::internal::TcParser::ParseLoop(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcParseTableBase const*) (generated_message_tctable_lite.cc:92)
==68934== by 0x498DA26: google::protobuf::internal::ParseNoReflection(std::basic_string_view<char, std::char_traits<char> >, google::protobuf::MessageLite&) (descriptor.cc:9520)
==68934== by 0x497E584: UnknownInlinedFun (descriptor.cc:1097)
==68934== by 0x497E584: UnknownInlinedFun (descriptor.cc:1102)
==68934== by 0x497E584: google::protobuf::DescriptorBuilder::BuildFileImpl(google::protobuf::FileDescriptorProto const&, google::protobuf::internal::FlatAllocator&) (descriptor.cc:5672)
==68934== by 0x497F978: google::protobuf::DescriptorBuilder::BuildFile(google::protobuf::FileDescriptorProto const&) (descriptor.cc:5632)
==68934== by 0x498033E: google::protobuf::DescriptorPool::BuildFileFromDatabase(google::protobuf::FileDescriptorProto const&) const (descriptor.cc:4551)
==68934== by 0x496D405: google::protobuf::DescriptorPool::TryFindFileInFallbackDatabase(std::basic_string_view<char, std::char_traits<char> >) const (descriptor.cc:2563)
==68934== by 0x496D956: google::protobuf::DescriptorPool::FindFileByName(std::basic_string_view<char, std::char_traits<char> >) const (descriptor.cc:2143)
==68934== by 0x4A02C1C: google::protobuf::(anonymous namespace)::AssignDescriptorsImpl(google::protobuf::internal::DescriptorTable const*, bool) [clone .lto_priv.0] (generated_message_reflection.cc:3626)
==68934==
==68934== 96 bytes in 3 blocks are possibly lost in loss record 3 of 6
==68934== at 0x4843223: operator new[](unsigned long) (vg_replace_malloc.c:714)
==68934== by 0x49E10F9: UnknownInlinedFun (arena.h:298)
==68934== by 0x49E10F9: UnknownInlinedFun (arena.h:289)
==68934== by 0x49E10F9: google::protobuf::internal::ExtensionSet::GrowCapacity(unsigned long) (extension_set.cc:1647)
==68934== by 0x49D6BC6: google::protobuf::internal::ExtensionSet::Insert(int) (extension_set.cc:1618)
==68934== by 0x49D6E25: google::protobuf::internal::ExtensionSet::MaybeNewExtension(int, google::protobuf::FieldDescriptor const*, google::protobuf::internal::ExtensionSet::Extension**) (extension_set.cc:1277)
==68934== by 0x49D7E33: google::protobuf::internal::ExtensionSet::MutableMessage(int, unsigned char, google::protobuf::MessageLite const&, google::protobuf::FieldDescriptor const*) (extension_set.cc:598)
==68934== by 0x49E85B1: UnknownInlinedFun (extension_set_inl.h:171)
==68934== by 0x49E85B1: google::protobuf::internal::ExtensionSet::ParseField(unsigned long, char const*, google::protobuf::Message const*, google::protobuf::internal::InternalMetadata*, google::protobuf::internal::ParseContext*) (extension_set_heavy.cc:319)
==68934== by 0x4A0A19D: UnknownInlinedFun (generated_message_tctable_impl.h:922)
==68934== by 0x4A0A19D: google::protobuf::internal::TcParser::ParseLoop(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcParseTableBase const*) (generated_message_tctable_lite.cc:92)
==68934== by 0x4A0A9B8: UnknownInlinedFun (parse_context.h:519)
==68934== by 0x4A0A9B8: UnknownInlinedFun (generated_message_tctable_lite.cc:392)
==68934== by 0x4A0A9B8: google::protobuf::internal::TcParser::FastMtS1(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcFieldData, google::protobuf::internal::TcParseTableBase const*, unsigned long) (generated_message_tctable_lite.cc:427)
==68934== by 0x4A0A19D: UnknownInlinedFun (generated_message_tctable_impl.h:922)
==68934== by 0x4A0A19D: google::protobuf::internal::TcParser::ParseLoop(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcParseTableBase const*) (generated_message_tctable_lite.cc:92)
==68934== by 0x4A0BCAA: UnknownInlinedFun (parse_context.h:519)
==68934== by 0x4A0BCAA: UnknownInlinedFun (generated_message_tctable_lite.cc:480)
==68934== by 0x4A0BCAA: google::protobuf::internal::TcParser::FastMtR1(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcFieldData, google::protobuf::internal::TcParseTableBase const*, unsigned long) (generated_message_tctable_lite.cc:521)
==68934== by 0x4A0A19D: UnknownInlinedFun (generated_message_tctable_impl.h:922)
==68934== by 0x4A0A19D: google::protobuf::internal::TcParser::ParseLoop(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcParseTableBase const*) (generated_message_tctable_lite.cc:92)
==68934== by 0x498DA26: google::protobuf::internal::ParseNoReflection(std::basic_string_view<char, std::char_traits<char> >, google::protobuf::MessageLite&) (descriptor.cc:9520)
==68934==
==68934== 96 bytes in 3 blocks are possibly lost in loss record 4 of 6
==68934== at 0x4841FC3: operator new(unsigned long) (vg_replace_malloc.c:472)
==68934== by 0x495BCCA: UnknownInlinedFun (arena.h:454)
==68934== by 0x495BCCA: UnknownInlinedFun (arena.h:535)
==68934== by 0x495BCCA: UnknownInlinedFun (arena.h:562)
==68934== by 0x495BCCA: UnknownInlinedFun (arena.h:575)
==68934== by 0x495BCCA: UnknownInlinedFun (message_lite.h:505)
==68934== by 0x495BCCA: pb::CppFeatures::New(google::protobuf::Arena*) const (cpp_features.pb.h:162)
==68934== by 0x49D7E76: google::protobuf::internal::ExtensionSet::MutableMessage(int, unsigned char, google::protobuf::MessageLite const&, google::protobuf::FieldDescriptor const*) (extension_set.cc:603)
==68934== by 0x49E85B1: UnknownInlinedFun (extension_set_inl.h:171)
==68934== by 0x49E85B1: google::protobuf::internal::ExtensionSet::ParseField(unsigned long, char const*, google::protobuf::Message const*, google::protobuf::internal::InternalMetadata*, google::protobuf::internal::ParseContext*) (extension_set_heavy.cc:319)
==68934== by 0x4A0A19D: UnknownInlinedFun (generated_message_tctable_impl.h:922)
==68934== by 0x4A0A19D: google::protobuf::internal::TcParser::ParseLoop(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcParseTableBase const*) (generated_message_tctable_lite.cc:92)
==68934== by 0x4A0A9B8: UnknownInlinedFun (parse_context.h:519)
==68934== by 0x4A0A9B8: UnknownInlinedFun (generated_message_tctable_lite.cc:392)
==68934== by 0x4A0A9B8: google::protobuf::internal::TcParser::FastMtS1(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcFieldData, google::protobuf::internal::TcParseTableBase const*, unsigned long) (generated_message_tctable_lite.cc:427)
==68934== by 0x4A0A19D: UnknownInlinedFun (generated_message_tctable_impl.h:922)
==68934== by 0x4A0A19D: google::protobuf::internal::TcParser::ParseLoop(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcParseTableBase const*) (generated_message_tctable_lite.cc:92)
==68934== by 0x4A0BCAA: UnknownInlinedFun (parse_context.h:519)
==68934== by 0x4A0BCAA: UnknownInlinedFun (generated_message_tctable_lite.cc:480)
==68934== by 0x4A0BCAA: google::protobuf::internal::TcParser::FastMtR1(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcFieldData, google::protobuf::internal::TcParseTableBase const*, unsigned long) (generated_message_tctable_lite.cc:521)
==68934== by 0x4A0A19D: UnknownInlinedFun (generated_message_tctable_impl.h:922)
==68934== by 0x4A0A19D: google::protobuf::internal::TcParser::ParseLoop(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcParseTableBase const*) (generated_message_tctable_lite.cc:92)
==68934== by 0x498DA26: google::protobuf::internal::ParseNoReflection(std::basic_string_view<char, std::char_traits<char> >, google::protobuf::MessageLite&) (descriptor.cc:9520)
==68934== by 0x497E584: UnknownInlinedFun (descriptor.cc:1097)
==68934== by 0x497E584: UnknownInlinedFun (descriptor.cc:1102)
==68934== by 0x497E584: google::protobuf::DescriptorBuilder::BuildFileImpl(google::protobuf::FileDescriptorProto const&, google::protobuf::internal::FlatAllocator&) (descriptor.cc:5672)
==68934== by 0x497F978: google::protobuf::DescriptorBuilder::BuildFile(google::protobuf::FileDescriptorProto const&) (descriptor.cc:5632)
==68934==
==68934== 120 bytes in 3 blocks are possibly lost in loss record 5 of 6
==68934== at 0x4841FC3: operator new(unsigned long) (vg_replace_malloc.c:472)
==68934== by 0x4962B2A: UnknownInlinedFun (arena.h:454)
==68934== by 0x4962B2A: UnknownInlinedFun (arena.h:535)
==68934== by 0x4962B2A: UnknownInlinedFun (arena.h:562)
==68934== by 0x4962B2A: UnknownInlinedFun (arena.h:575)
==68934== by 0x4962B2A: UnknownInlinedFun (message_lite.h:505)
==68934== by 0x4962B2A: google::protobuf::FeatureSetDefaults_FeatureSetEditionDefault::New(google::protobuf::Arena*) const (descriptor.pb.h:3542)
==68934== by 0x4A0BD56: UnknownInlinedFun (repeated_ptr_field.h:918)
==68934== by 0x4A0BD56: UnknownInlinedFun (repeated_ptr_field.h:235)
==68934== by 0x4A0BD56: UnknownInlinedFun (repeated_ptr_field.h:230)
==68934== by 0x4A0BD56: UnknownInlinedFun (generated_message_tctable_lite.cc:474)
==68934== by 0x4A0BD56: google::protobuf::internal::TcParser::FastMtR1(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcFieldData, google::protobuf::internal::TcParseTableBase const*, unsigned long) (generated_message_tctable_lite.cc:521)
==68934== by 0x4A0A19D: UnknownInlinedFun (generated_message_tctable_impl.h:922)
==68934== by 0x4A0A19D: google::protobuf::internal::TcParser::ParseLoop(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcParseTableBase const*) (generated_message_tctable_lite.cc:92)
==68934== by 0x498DA26: google::protobuf::internal::ParseNoReflection(std::basic_string_view<char, std::char_traits<char> >, google::protobuf::MessageLite&) (descriptor.cc:9520)
==68934== by 0x497E584: UnknownInlinedFun (descriptor.cc:1097)
==68934== by 0x497E584: UnknownInlinedFun (descriptor.cc:1102)
==68934== by 0x497E584: google::protobuf::DescriptorBuilder::BuildFileImpl(google::protobuf::FileDescriptorProto const&, google::protobuf::internal::FlatAllocator&) (descriptor.cc:5672)
==68934== by 0x497F978: google::protobuf::DescriptorBuilder::BuildFile(google::protobuf::FileDescriptorProto const&) (descriptor.cc:5632)
==68934== by 0x498033E: google::protobuf::DescriptorPool::BuildFileFromDatabase(google::protobuf::FileDescriptorProto const&) const (descriptor.cc:4551)
==68934== by 0x496D405: google::protobuf::DescriptorPool::TryFindFileInFallbackDatabase(std::basic_string_view<char, std::char_traits<char> >) const (descriptor.cc:2563)
==68934== by 0x496D956: google::protobuf::DescriptorPool::FindFileByName(std::basic_string_view<char, std::char_traits<char> >) const (descriptor.cc:2143)
==68934== by 0x4A02C1C: google::protobuf::(anonymous namespace)::AssignDescriptorsImpl(google::protobuf::internal::DescriptorTable const*, bool) [clone .lto_priv.0] (generated_message_reflection.cc:3626)
==68934== by 0x4AB9950: UnknownInlinedFun (generated_message_reflection.cc:3707)
==68934== by 0x4AB9950: UnknownInlinedFun (invoke.h:61)
==68934== by 0x4AB9950: UnknownInlinedFun (invoke.h:96)
==68934== by 0x4AB9950: UnknownInlinedFun (functional:113)
==68934== by 0x4AB9950: void absl::lts_20230802::base_internal::CallOnceImpl<google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), absl::lts_20230802::once_flag*, google::protobuf::Metadata const&)::{lambda()#1}>(std::atomic<unsigned int>*, absl::lts_20230802::base_internal::SchedulingMode, google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const* (*)(), absl::lts_20230802::once_flag*, google::protobuf::Metadata const&)::{lambda()#1}&&) [clone .constprop.0] (call_once.h:178)
==68934==
==68934== 216 bytes in 3 blocks are possibly lost in loss record 6 of 6
==68934== at 0x4841FC3: operator new(unsigned long) (vg_replace_malloc.c:472)
==68934== by 0x496281A: UnknownInlinedFun (arena.h:454)
==68934== by 0x496281A: UnknownInlinedFun (arena.h:535)
==68934== by 0x496281A: UnknownInlinedFun (arena.h:562)
==68934== by 0x496281A: UnknownInlinedFun (arena.h:575)
==68934== by 0x496281A: UnknownInlinedFun (message_lite.h:505)
==68934== by 0x496281A: google::protobuf::FeatureSet::New(google::protobuf::Arena*) const (descriptor.pb.h:1721)
==68934== by 0x4A0AAA4: UnknownInlinedFun (generated_message_tctable_lite.cc:386)
==68934== by 0x4A0AAA4: google::protobuf::internal::TcParser::FastMtS1(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcFieldData, google::protobuf::internal::TcParseTableBase const*, unsigned long) (generated_message_tctable_lite.cc:427)
==68934== by 0x4A0A19D: UnknownInlinedFun (generated_message_tctable_impl.h:922)
==68934== by 0x4A0A19D: google::protobuf::internal::TcParser::ParseLoop(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcParseTableBase const*) (generated_message_tctable_lite.cc:92)
==68934== by 0x4A0BCAA: UnknownInlinedFun (parse_context.h:519)
==68934== by 0x4A0BCAA: UnknownInlinedFun (generated_message_tctable_lite.cc:480)
==68934== by 0x4A0BCAA: google::protobuf::internal::TcParser::FastMtR1(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcFieldData, google::protobuf::internal::TcParseTableBase const*, unsigned long) (generated_message_tctable_lite.cc:521)
==68934== by 0x4A0A19D: UnknownInlinedFun (generated_message_tctable_impl.h:922)
==68934== by 0x4A0A19D: google::protobuf::internal::TcParser::ParseLoop(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcParseTableBase const*) (generated_message_tctable_lite.cc:92)
==68934== by 0x498DA26: google::protobuf::internal::ParseNoReflection(std::basic_string_view<char, std::char_traits<char> >, google::protobuf::MessageLite&) (descriptor.cc:9520)
==68934== by 0x497E584: UnknownInlinedFun (descriptor.cc:1097)
==68934== by 0x497E584: UnknownInlinedFun (descriptor.cc:1102)
==68934== by 0x497E584: google::protobuf::DescriptorBuilder::BuildFileImpl(google::protobuf::FileDescriptorProto const&, google::protobuf::internal::FlatAllocator&) (descriptor.cc:5672)
==68934== by 0x497F978: google::protobuf::DescriptorBuilder::BuildFile(google::protobuf::FileDescriptorProto const&) (descriptor.cc:5632)
==68934== by 0x498033E: google::protobuf::DescriptorPool::BuildFileFromDatabase(google::protobuf::FileDescriptorProto const&) const (descriptor.cc:4551)
==68934== by 0x496D405: google::protobuf::DescriptorPool::TryFindFileInFallbackDatabase(std::basic_string_view<char, std::char_traits<char> >) const (descriptor.cc:2563)
==68934== by 0x496D956: google::protobuf::DescriptorPool::FindFileByName(std::basic_string_view<char, std::char_traits<char> >) const (descriptor.cc:2143)
==68934==
==68934== LEAK SUMMARY:
==68934== definitely lost: 0 bytes in 0 blocks
==68934== indirectly lost: 0 bytes in 0 blocks
==68934== possibly lost: 560 bytes in 13 blocks
==68934== still reachable: 56 bytes in 1 blocks
==68934== suppressed: 0 bytes in 0 blocks
==68934== Reachable blocks (those to which a pointer was found) are not shown.
==68934== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==68934==
==68934== For lists of detected and suppressed errors, rerun with: -s
==68934== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 0 from 0)
Anything else we should know about your project / environment
ASAN does not indicate anything, so this might be an valgrind thing. Also happens if google::protobuf::util::MessageToJsonString is called.
Activity