diff --git a/services/distributeddataservice/libs/distributeddb/common/src/flatbuffer_schema.cpp b/services/distributeddataservice/libs/distributeddb/common/src/flatbuffer_schema.cpp index a9f97fe0e59ce6bc6d74fb23a5a1659ae2902e4c..55374327c90fd5c263c61a96477236f2f9eb4c35 100755 --- a/services/distributeddataservice/libs/distributeddb/common/src/flatbuffer_schema.cpp +++ b/services/distributeddataservice/libs/distributeddb/common/src/flatbuffer_schema.cpp @@ -14,9 +14,6 @@ */ #include "schema_object.h" -#ifndef OMIT_FLATBUFFER -#include -#endif // OMIT_FLATBUFFER #include #include #include "schema_utils.h" @@ -67,28 +64,7 @@ bool SchemaObject::FlatBufferSchema::IsFlatBufferSchema(const std::string &inOri outDecoded = inOriginal; // The original one is the decoded one return true; } - // Try base64 decode. base64 decoded length less then original length. - outDecoded.resize(inOriginal.size()); - if (outDecoded.size() != inOriginal.size()) { // Unlikely in normal situation - // Do such check since we will directly access the memory inside outDecoded following - LOGE("[FBSchema][Is] Resize=%zu fail, OOM.", inOriginal.size()); - return false; - } - auto decodeBuf = reinterpret_cast(outDecoded.data()); // changeable buffer - int decodeLen = b64_pton(inOriginal.c_str(), decodeBuf, outDecoded.size()); - LOGD("[FBSchema][Is] Base64 decodeLen=%d, oriLen=%zu.", decodeLen, inOriginal.size()); - if (decodeLen <= 0 || decodeLen >= static_cast(inOriginal.size())) { - outDecoded.clear(); - return false; - } - // Base64 decode success! It should be an encode form of flatBuffer-Schema. - outDecoded.erase(outDecoded.begin() + decodeLen, outDecoded.end()); // Erase surplus space - auto decodeSchemaBuf = reinterpret_cast(outDecoded.c_str()); // Reget the memory after erase. - flatbuffers::Verifier decodeVerifier(decodeSchemaBuf, outDecoded.size()); - if (reflection::VerifySizePrefixedSchemaBuffer(decodeVerifier)) { - return true; - } - LOGE("[FBSchema][Is] Base64 decode success but verify fail."); + outDecoded.clear(); return false; } diff --git a/services/distributeddataservice/libs/distributeddb/include/types_export.h b/services/distributeddataservice/libs/distributeddb/include/types_export.h index 76e9489041141d5d509a055299b29eba3220aff6..b8063b1f33958016dc57a4e92b0d14b5b87b9117 100755 --- a/services/distributeddataservice/libs/distributeddb/include/types_export.h +++ b/services/distributeddataservice/libs/distributeddb/include/types_export.h @@ -150,12 +150,6 @@ struct SecurityOption { { return securityLabel == rhs.securityLabel && securityFlag == rhs.securityFlag; } - - void operator=(const SecurityOption &rhs) - { - securityLabel = rhs.securityLabel; - securityFlag = rhs.securityFlag; - } }; } // namespace DistributedDB