Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion binary/decoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,14 @@ jspb.BinaryDecoder.prototype.readString = function(length) {
var result = '';
while (cursor < end) {
var c = bytes[cursor++];
if (c < 128) { // Regular 7-bit ASCII.
if (c == 0) {
// NUL char should not occur in the middle of a String, abort decode
// We may get back in sync by avoiding malformed strings or there
// may be corruption in whatever was stored as text to begin with.
result += goog.crypt.byteArrayToString(codeUnits);
cursor=end;
continue;
} else if (c < 128) { // Regular 7-bit ASCII.
codeUnits.push(c);
} else if (c < 192) {
// UTF-8 continuation mark. We are out of sync. This
Expand Down