wasphin commented on code in PR #3659:
URL: https://github.com/apache/brpc/pull/3659#discussion_r4505935881


##########
src/brpc/couchbase.cpp:
##########
@@ -50,6 +51,7 @@ constexpr uint32_t APPLE_VBUCKET_COUNT ALLOW_UNUSED = 64;
 constexpr uint32_t DEFAULT_VBUCKET_COUNT ALLOW_UNUSED = 1024;
 constexpr int CONNECTION_ID_SIZE = 33;
 constexpr size_t RANDOM_ID_HEX_SIZE = 67;  // 33 bytes * 2 + null terminator
+
 }  // namespace

Review Comment:
   Removed the leftover blank line in 7b4d2f34.



##########
src/brpc/couchbase.cpp:
##########
@@ -124,11 +126,8 @@ bool CouchbaseManifestManager::jsonToCollectionManifest(
     return false;
   }
 
-  // Parse JSON using RapidJSON
   BUTIL_RAPIDJSON_NAMESPACE::Document document;
-  document.Parse(json.c_str());
-
-  if (document.HasParseError()) {
+  if (!ParseJsonWithDepthLimit(json, &document)) {
     DEBUG_PRINT("Failed to parse JSON: " << document.GetParseError());

Review Comment:
   Addressed in 7b4d2f34. Syntax failures still report the parser error code. 
If pre-validation rejects the input before parsing, the diagnostic instead 
states that an embedded NUL or nesting beyond the 100-level limit (including 
the root) caused rejection. This avoids reporting a successful parse status as 
an error, without rescanning the input or changing the helper API. All six 
CouchbaseUnitTest tests pass.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to