You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I got a problem about memory allocation when I test ABI compatibility of dynamic proto library. What version of protobuf and what language are you using?
Version: v3.19.6
Language: C++
What operating system (Linux, Windows, ...) and version?
Linux Ubuntu 20.04.6
What runtime / compiler are you using (e.g., python version or gcc version)
gcc 9.4.0
What did you do?
I make a program to test ABI compatibility of proto dynamic library.
This program is constructed with MessageClass(which is defined by proto), Class1, Class2, some communication class and entry main. In this program, I make Class1 object to create a MessageClass object and transform to Class2 object.
The MessageClass consists of two fields, version and message, both of which are of type string.
I make three dynamic libraries for Class1, Class2 and MessageClass. Class1 and Class2 depends on MessageClass.
When I run the program as usual, there is no problem. However, the following are the actions that cause the problem:
Build the program and copy Class1 library for backup.
Add a test field at the last of MessageClass in *.proto file(its field number is larger than other field), and then build the program without modifying other parts.
Replace new Class1 library with backup library.
Run program.
What did you expect to see
I think it should run as if I have not replaced Class1 library.
What did you see instead?
A coredump happened. It shows malloc(): invalid size (unsorted) when running the code defined in Class1.
We use gdb to find error location, and find that errors may occur in different positions, but they must occur during memory allocation. When I define an additional std::string object with over 16 length in member function of Class1 , or set message field of MessageClass object, it will crash when allocate more memory. However, the program is little enough and do not need much memory.
I tried to define a MessageClass in usual way instead of using proto, and performed the above actions that may result in errors. The program runs normally. So I think it may be a feature or bug of dynamic proto library which limits memory allocation.
Anything else we should know about your project / environment
I use bazel 6.5.0 in this program, and use cc_shared_library wrapped with cc_import to build and dynamically link these dynamic libraries.
The text was updated successfully, but these errors were encountered:
Hello, I got a problem about memory allocation when I test ABI compatibility of dynamic proto library.
What version of protobuf and what language are you using?
Version: v3.19.6
Language: C++
What operating system (Linux, Windows, ...) and version?
Linux Ubuntu 20.04.6
What runtime / compiler are you using (e.g., python version or gcc version)
gcc 9.4.0
What did you do?
I make a program to test ABI compatibility of proto dynamic library.
This program is constructed with MessageClass(which is defined by proto), Class1, Class2, some communication class and entry main. In this program, I make Class1 object to create a MessageClass object and transform to Class2 object.
The MessageClass consists of two fields,
version
andmessage
, both of which are of type string.I make three dynamic libraries for Class1, Class2 and MessageClass. Class1 and Class2 depends on MessageClass.
When I run the program as usual, there is no problem. However, the following are the actions that cause the problem:
test
field at the last of MessageClass in *.proto file(its field number is larger than other field), and then build the program without modifying other parts.What did you expect to see
I think it should run as if I have not replaced Class1 library.
What did you see instead?
A coredump happened. It shows
malloc(): invalid size (unsorted)
when running the code defined in Class1.We use gdb to find error location, and find that errors may occur in different positions, but they must occur during memory allocation. When I define an additional
std::string
object with over 16 length in member function of Class1 , or set message field of MessageClass object, it will crash when allocate more memory. However, the program is little enough and do not need much memory.I tried to define a MessageClass in usual way instead of using proto, and performed the above actions that may result in errors. The program runs normally. So I think it may be a feature or bug of dynamic proto library which limits memory allocation.
Anything else we should know about your project / environment
I use bazel 6.5.0 in this program, and use
cc_shared_library
wrapped withcc_import
to build and dynamically link these dynamic libraries.The text was updated successfully, but these errors were encountered: