Status: New
Owner: ken...@google.com
Labels: Type-Defect Priority-Medium
New issue 205 by ngollan: Invalid strings are delivered to application
http://code.google.com/p/protobuf/issues/detail?id=205
What steps will reproduce the problem?
1. Have a field of type "string"
2. Fill field with invalid UTF-8, e.g. repeated '\xff'
3. Serialize/parse
What is the expected output? What do you see instead?
Expected: The invalid data is not accepted by the serializer/parser, and
not delivered to the application. Parsing should fail.
Actual result: libprotobuf prints an "error" message to standard error, but
completely disregards it and serializes/parses invalid data just fine. The
library is thus incompatible with its own requirements, and prints
misleading error messages.
What version of the product are you using? On what operating system?
Version 2.3.0 from Debian GNU/Linux "unstable" packages
Please provide any additional information below.
See attached sample code.
The error messages read:
* libprotobuf ERROR google/protobuf/wire_format.cc:1059] Encountered string
containing invalid UTF-8 data while serializing protocol buffer. Strings
must contain only UTF-8; use the 'bytes' type for raw bytes.
* libprotobuf ERROR google/protobuf/wire_format.cc:1059] Encountered string
containing invalid UTF-8 data while parsing protocol buffer. Strings must
contain only UTF-8; use the 'bytes' type for raw bytes.
Those messages suggest that
(1) an ERROR condition has occurred, and serialization/parsing actually
*failed*;
(2) using the word "must" further suggests that invalid data *will not* be
delivered.
Attachments:
main.cpp 681 bytes
demo.proto 60 bytes
--
You received this message because you are subscribed to the Google Groups "Protocol
Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/protobuf?hl=en.