protobuf bool serilize bug
if proto message have a bool,but set is 222(not true,false 0,1), parse successfull,but the message remain filed is missing.
debug version is fine,but release is not ok.
Are you able to provide a more detailed example on how we can recreate this problem?
the enviroment is windows mingw , I try windows msvc is ok.
// message as follows message HelloRequest { bool isW = 1; string name = 2; }
HelloRequest request;
struct test{
bool a;
int b;
};
test bT;
*((unsigned char*)&bT.a)=138; //when bool is random value and over 128, parse is fine,but the value after bool is not ok.
request.set_isw(1);
request.set_name("hello");
std::string seriString = request.SerializeAsString();
HelloRequest request2;
if(!request2.ParseFromString(seriString)){
std::cout << "parse failed"<<std::endl;
}
std::cout << "request name:"<<request2.name();
result print as follows,"hello" is not pirnt request name:
request.set_isw(1) should be request.set_isw(bT.a)
The situation we encounter is that the bool value in the structure is uninitialized, and the random value is greater than 128
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive because the last activity was over 90 days ago.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.
This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.