diff --git a/app/rest/response_json.h b/app/rest/response_json.h index 7ed1aa64ae..237e0a2aee 100644 --- a/app/rest/response_json.h +++ b/app/rest/response_json.h @@ -22,6 +22,7 @@ #include "app/rest/response.h" #include "app/src/assert.h" +#include "app/src/log.h" #include "flatbuffers/idl.h" #include "flatbuffers/stl_emulation.h" @@ -74,12 +75,24 @@ class ResponseJson : public Response { // Parse and verify JSON string in body. FlatBuffer parser does not support // online parsing. So we only parse the body when we get everything. bool parse_status = parser_->Parse(GetBody()); - FIREBASE_ASSERT_RETURN_VOID(parse_status); + if (!parse_status) { + LogError("flatbuffers::Parser::Parse() failed: %s", + parser_->error_.c_str()); + application_data_.reset(new FbsTypeT()); + Response::MarkCompleted(); + return; + } + const flatbuffers::FlatBufferBuilder& builder = parser_->builder_; flatbuffers::Verifier verifier(builder.GetBufferPointer(), builder.GetSize()); bool verify_status = verifier.VerifyBuffer(nullptr); - FIREBASE_ASSERT_RETURN_VOID(verify_status); + if (!verify_status) { + LogError("flatbuffers::Verifier::VerifyBuffer() failed"); + application_data_.reset(new FbsTypeT()); + Response::MarkCompleted(); + return; + } // UnPack application data object from FlatBuffer. const FbsType* body_fbs = diff --git a/release_build_files/readme.md b/release_build_files/readme.md index 3edcdfce49..1de85ee778 100644 --- a/release_build_files/readme.md +++ b/release_build_files/readme.md @@ -576,6 +576,9 @@ code. - Messaging (Android): Fixes an issue to receive token when initialize the app. ([#667](https://github.com/firebase/firebase-cpp-sdk/pull/667)). + - Auth (Desktop): Fix a crash that would occur if parsing the JSON + response from the server failed + ([#692](https://github.com/firebase/firebase-cpp-sdk/pull/692)). ### 8.5.0 - Changes