You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by GitBox <gi...@apache.org> on 2021/03/03 01:22:10 UTC

[GitHub] [incubator-brpc] cstarc opened a new issue #1348: 附件大小限制问题,当大小大于uint32, 会有问题

cstarc opened a new issue #1348:
URL: https://github.com/apache/incubator-brpc/issues/1348


   **Describe the bug (描述bug)**
   message RpcMeta {
       optional RpcRequestMeta request = 1;
       optional RpcResponseMeta response = 2;
       optional int32 compress_type = 3;
       optional int64 correlation_id = 4;
       optional int32 attachment_size = 5;
       optional ChunkInfo chunk_info = 6;
       optional bytes authentication_data = 7;
       optional StreamSettings stream_settings = 8;   
   }
   attachment_size   是int32 ,但附件没有限制大小
   ProcessRpcResponse
   
           // Parse response message iff error code from meta is 0
           butil::IOBuf res_buf;
           **const int res_size** = msg->payload.length();
           butil::IOBuf* res_buf_ptr = &msg->payload;
           if (meta.has_attachment_size()) {
               if (meta.attachment_size() > res_size) {
                   cntl->SetFailed(
                       ERESPONSE,
                       "attachment_size=%d is larger than response_size=%d",
                       meta.attachment_size(), res_size);
                   break;
               }
               **int att_size** = res_size - meta.attachment_size();
               msg->payload.cutn(&res_buf, att_size);
               res_buf_ptr = &res_buf;
               cntl->response_attachment().swap(msg->payload);
           }
   
   在获取的时候都使用了int,当附件大小大于4G时会有问题。
   **To Reproduce (复现方法)**
   
   
   **Expected behavior (期望行为)**
   
   
   **Versions (各种版本)**
   OS:
   Compiler:
   brpc:
   protobuf:
   
   **Additional context/screenshots (更多上下文/截图)**
   
   


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org


[GitHub] [incubator-brpc] cstarc commented on issue #1348: 附件大小限制问题,当大小大于uint32, 会有问题

Posted by GitBox <gi...@apache.org>.
cstarc commented on issue #1348:
URL: https://github.com/apache/incubator-brpc/issues/1348#issuecomment-789352171


   PackRpcRequest
     
      const size_t req_size = request_body.length(); 
       **const size_t attached_size** = cntl->request_attachment().length();
       if (attached_size) {
           **meta.set_attachment_size(attached_size);**
       }
       Span* span = accessor.span();
       if (span) {
           request_meta->set_trace_id(span->trace_id());
           request_meta->set_span_id(span->span_id());
           request_meta->set_parent_span_id(span->parent_span_id());
       }
   
       SerializeRpcHeaderAndMeta(req_buf, meta, req_size + attached_size);
       req_buf->append(request_body);
       **if (attached_size) {
           req_buf->append(cntl->request_attachment());**
       }
   
   大小不一致


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org