-
Notifications
You must be signed in to change notification settings - Fork 124
Open
Description
Library version: v1.1
Proto:
syntax = "proto2";
import "google/protobuf/any.proto";
message Hello {
optional string field = 1;
optional google.protobuf.Any content = 2;
}
message Content1 {
optional string field = 1;
}
message Content2 {
optional string field = 1;
}
Code:
#include <iostream>
#include "src/text_format.h"
#include "src/mutator.h"
#include "hello.pb.h"
int main() {
Hello he;
Content1 c1;
c1.set_field("field1");
auto a = new google::protobuf::Any();
a->PackFrom(c1);
he.set_allocated_content(a);
std::cerr << "data:" << protobuf_mutator::SaveMessageAsText(he) << std::endl;
protobuf_mutator::Mutator mutator;
mutator.Seed(1);
mutator.Mutate(&he, 10000);
mutator.Fix(&he);
std::cerr << "data:" << protobuf_mutator::SaveMessageAsText(he) << std::endl;
}
Current result:
data:content {
type_url: "type.googleapis.com/Content1"
value: "\n\006field1"
}
data:content {
type_url: "type.gogleapi.\303\225om/Content1"
value: "\n\006field1"
}
Field 'type_url' is broken and application will not accept this message. It's also possible to get a broken (unparsable) field 'value'.
mudrykaa
Metadata
Metadata
Assignees
Labels
No labels