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 285036fc4ba7d7e609305b3cefbd1ec2604efcc2..506600cb898dc82808c3265ebfc3c1da70b1dceb 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 @@ -108,13 +108,19 @@ int CheckCommon::CheckFilter(JsonObject &filterObj, bool &isOnlyId, std::vector< isOnlyId = false; } for (int i = 0; i < filterPath.size(); i++) { - for (auto fieldName : filterPath[i]) { - for (int j = 0; j < fieldName.size(); j++) { - if (!((isalpha(fieldName[j])) || (isdigit(fieldName[j])) || ('_' == fieldName[j]))) { + for (int j = 0; j < filterPath[i].size(); j++) { + if (filterPath[i].empty()) { + return -E_INVALID_JSON_FORMAT; + } + for (auto oneChar : filterPath[i][j]) { + if (!((isalpha(oneChar)) || (isdigit(oneChar)) || ('_' == oneChar))) { return -E_INVALID_ARGS; } } } + if (!filterPath[i].empty() && !filterPath[i][0].empty() && isdigit(filterPath[i][0][0])) { + return -E_INVALID_ARGS; + } } bool isIdExisit = false; int ret = CheckIdFormat(filterObj, isIdExisit); @@ -284,6 +290,9 @@ bool CheckCommon::CheckProjection(JsonObject &projectionObj, std::vector