Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String field xxx contains invalid UTF-8 data when serializing a protocol buffer #197

Open
littleningmeng opened this issue Aug 4, 2021 · 4 comments

Comments

@littleningmeng
Copy link

How to fix the error below when I call mutator.Mutate(&message, 4096);

[libprotobuf ERROR google/protobuf/wire_format_lite.cc:577] String field 'xxxxx' contains invalid UTF-8 data when serializing a protocol buffer. Use the 'bytes' type if you intend to send raw bytes.

@vitalybuka
Copy link
Collaborator

I guess documentation is misleading https://github.com/google/libprotobuf-mutator#usage
Direct use of protobuf_mutator::Mutator needs some additional work.
Optionally is incorrect. Default implementations of "Mutate" is just good enough for unittests, e.g. it does not preserve UTF8 correctness.

Lib is actively used and supported for https://github.com/google/libprotobuf-mutator#integrating-with-libfuzzer

@littleningmeng
Copy link
Author

I change my code to the DEFINE_PROTO_FUZZER type.
Also I got the same error.
image
image

@vitalybuka
Copy link
Collaborator

Is this a proto2 or proto3
Is this on empty corpus? or it already contains some inputs?

@littleningmeng
Copy link
Author

It's proto3 and the message is empty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants