Copilot commented on code in PR #3493:
URL: https://github.com/apache/brpc/pull/3493#discussion_r3865010421


##########
src/brpc/stream.cpp:
##########
@@ -1034,6 +1039,20 @@ int StreamAccept(StreamIds& response_streams, 
Controller& cntl,
         LOG(ERROR) << "No stream along with this request";
         return -1;
     }
+    const int64_t stream_count = static_cast<int64_t>(
+        cntl._remote_stream_settings->extra_stream_ids_size()) + 1;
+    if (stream_count > FLAGS_stream_max_streams_per_request) {
+        cntl.SetFailed(EREQUEST,
+                       "Reject %" PRId64 " streams in one request, exceeding "
+                       "-stream_max_streams_per_request=%" PRId64,
+                       stream_count,
+                       FLAGS_stream_max_streams_per_request);

Review Comment:
   The SetFailed() format string uses PRId64 for the max-streams flag, but 
FLAGS_stream_max_streams_per_request is an int32. Passing an int to a %" PRId64 
specifier is undefined behavior in varargs and can corrupt the formatted 
message at runtime. Cast the flag to int64_t (or change the format to PRId32) 
to make the types match.



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