Copilot commented on code in PR #3666:
URL: https://github.com/apache/brpc/pull/3666#discussion_r4373669039
##########
src/brpc/redis_reply.cpp:
##########
@@ -150,8 +150,15 @@ ParseError RedisReply::ConsumePartialIOBuf(butil::IOBuf&
buf, int depth,
switch (fc) {
case '-': // Error "-<message>\r\n"
case '+': { // Simple String "+<string>\r\n"
- butil::IOBuf str;
- if (buf.cut_until(&str, "\r\n") != 0) {
+ if (_length != kScanningLine) {
+ _type = REDIS_REPLY_NIL;
+ _length = kScanningLine;
+ _data.line = {};
Review Comment:
An incomplete simple/error reply now has `_length == kScanningLine` and its
cursor in `_data.line`, but `CopyFromDifferentArena` does not copy this new
state (it only switches on `REDIS_REPLY_*` and treats the source as NIL).
Copying a reply after `ConsumePartialIOBuf` returns
`PARSE_ERROR_NOT_ENOUGH_DATA` leaves the destination with a stale/default
cursor; resuming it will not find the terminator. Handle the scanning state in
the deep copy (including nested partial state) or explicitly reject/document
copying partial replies.
This issue also appears on line 158 of the same file.
--
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]