Copilot commented on code in PR #13635:
URL: https://github.com/apache/trafficserver/pull/13635#discussion_r3956088748


##########
src/proxy/http3/Http3Transaction.cc:
##########
@@ -225,6 +225,13 @@ HQTransaction::transaction_done()
 
 int
 HQTransaction::get_transaction_id() const
+{
+  // Narrowing is intentional here; see get_quic_stream_id() for the 
full-width value.
+  return static_cast<int>(this->_stream_id);
+}

Review Comment:
   `static_cast<int>(_stream_id)` can produce implementation-defined results 
when `QUICStreamId` exceeds the representable range of `int` (e.g., yielding 
negative values), which can make logs/probes confusing and behavior 
platform-dependent. If the intent is “low 32 bits” (or similar) rather than a 
value-preserving cast, consider making the truncation semantics explicit (e.g., 
by truncating to a fixed-width unsigned type first and documenting the exact 
behavior), or using a checked/numeric-cast helper (assert/clamp) if 
out-of-range values should not appear in these call sites.



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

Reply via email to