From 9307f4893008f7d6cf9473e906d4c896546c5c8c Mon Sep 17 00:00:00 2001 From: rsgowman Date: Tue, 5 Jun 2018 12:24:14 -0400 Subject: Skip unknown fields while decoding BatchGetDocumentsResponse proto objects (#1377) --- Firestore/core/src/firebase/firestore/remote/serializer.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'Firestore/core/src') 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 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 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); } } -- cgit v1.2.3