bneradt commented on code in PR #14121:
URL: https://github.com/apache/trafficserver/pull/14121#discussion_r4683167492


##########
include/tsutil/DbgCtl.h:
##########
@@ -49,9 +49,11 @@ class DebugInterface
   static void            set_instance(DebugInterface *);
 
   // Generate the default diagnostics format string for the given parameters.
+  // @a format_writer must have at least 2 bytes of capacity left.

Review Comment:
   **[P3] Handle an empty writer with exactly two bytes of capacity.** This 
input meets the documented requirement. The internal `restrict(2)` then leaves 
zero capacity for the prefix, and `restore(2)` can leave `view()` empty. 
Calling `back()` on that view is undefined. Use an empty-safe suffix check or 
tighten the contract to require a fresh writer, as both in-tree callers already 
provide.



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