From 3675c054f29a5ca413d11f86ef43636fdc2c14c7 Mon Sep 17 00:00:00 2001 From: Jeremyzz Date: Wed, 10 May 2023 10:30:33 +0800 Subject: [PATCH] fix emptyFieldNameBUG Signed-off-by: Jeremyzz --- .../src/executor/document/document_check.cpp | 17 +++++++++++++---- .../test/unittest/api/documentdb_find_test.cpp | 9 +++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/services/distributeddataservice/service/data_share/gaussdb_rd_simple/src/executor/document/document_check.cpp b/services/distributeddataservice/service/data_share/gaussdb_rd_simple/src/executor/document/document_check.cpp index 94bb5138..2763a970 100644 --- a/services/distributeddataservice/service/data_share/gaussdb_rd_simple/src/executor/document/document_check.cpp +++ b/services/distributeddataservice/service/data_share/gaussdb_rd_simple/src/executor/document/document_check.cpp @@ -99,9 +99,12 @@ int CheckCommon::CheckFilter(JsonObject &filterObj, bool &isOnlyId, std::vector< isOnlyId = false; } for (int i = 0; i < filterPath.size(); i++) { + if (filterPath[i].empty()) { + return -E_INVALID_JSON_FORMAT; + } for (int j = 0; j < filterPath[i].size(); j++) { - if (filterPath[i].empty()) { - return -E_INVALID_JSON_FORMAT; + if (filterPath[i][j].empty()) { + return -E_INVALID_ARGS; } for (auto oneChar : filterPath[i][j]) { if (!((isalpha(oneChar)) || (isdigit(oneChar)) || ('_' == oneChar))) { @@ -246,6 +249,9 @@ int CheckCommon::CheckUpdata(JsonObject &updataObj, std::vector