wwbmmm commented on code in PR #3402:
URL: https://github.com/apache/brpc/pull/3402#discussion_r3651549171


##########
src/brpc/couchbase.cpp:
##########
@@ -1506,10 +1506,14 @@ bool 
CouchbaseOperations::CouchbaseResponse::popCollectionId(
 
   if (header.status != 0) {
     // handle error case
-    _buf.pop_front(sizeof(header) + header.extras_length + header.key_length);
     // Possibly read error message from value if present
-    size_t value_size =
-        header.total_body_length - header.extras_length - header.key_length;
+    const int value_size = (int)header.total_body_length -
+                           (int)header.extras_length - (int)header.key_length;
+    if (value_size < 0) {
+      butil::string_printf(&_err, "value_size=%d is negative", value_size);
+      return false;
+    }

Review Comment:
   +1



-- 
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