diff options
author | rsgowman <rgowman@google.com> | 2018-06-05 12:24:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-05 12:24:14 -0400 |
commit | 9307f4893008f7d6cf9473e906d4c896546c5c8c (patch) | |
tree | 5919d80429ec89a1c805cd0f5692d8cb0547bc85 /Firestore/core/src/firebase/firestore/remote | |
parent | 77227f58a03ac1383237f7239a337a7c061b5227 (diff) |
Skip unknown fields while decoding BatchGetDocumentsResponse proto objects (#1377)
Diffstat (limited to 'Firestore/core/src/firebase/firestore/remote')
-rw-r--r-- | Firestore/core/src/firebase/firestore/remote/serializer.cc | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Firestore/core/src/firebase/firestore/remote/serializer.cc b/Firestore/core/src/firebase/firestore/remote/serializer.cc index eee56f8..19a068b 100644 --- a/Firestore/core/src/firebase/firestore/remote/serializer.cc +++ b/Firestore/core/src/firebase/firestore/remote/serializer.cc @@ -551,9 +551,10 @@ std::unique_ptr<MaybeDocument> Serializer::DecodeBatchGetDocumentsResponse( break; default: - reader->set_status(Status( - FirestoreErrorCode::DataLoss, - "Input proto bytes cannot be parsed (invalid field number (tag))")); + // Unknown tag. According to the proto spec, we need to ignore these. No + // action required here, though we'll need to skip the relevant bytes + // below. + break; } if (!reader->status().ok()) return nullptr; @@ -595,11 +596,8 @@ std::unique_ptr<MaybeDocument> Serializer::DecodeBatchGetDocumentsResponse( break; default: - // This indicates an internal error as we've already ensured that this - // is a valid field_number. - HARD_FAIL( - "Somehow got an unexpected field number (tag) after verifying that " - "the field number was expected."); + // Unknown tag. According to the proto spec, we need to ignore these. + reader->SkipField(tag); } } |