bryancall opened a new pull request, #14121:
URL: https://github.com/apache/trafficserver/pull/14121

   `Dbg()`, `Error()`, `Warning()`, `TSError()` and the tscpp library's 
internal `LOG_DEBUG` and `LOG_ERROR` all build their output prefix through 
`DebugInterface::generate_format_string`, and `Dbg()` runs in dozens of 
destructors. The function calls swoc `BufferWriter::print`, which throws when 
it cannot parse its format string, so Coverity traces that throw into every 
destructor that logs: about 20 reports.
   
   It can't happen here. Every format string this function and the `bwformat` 
overloads it reaches pass to swoc is a fixed literal with positional arguments, 
none of the formatters for those arguments throw, and the caller's printf 
format is printed as the argument to `"{}"`, never parsed as a swoc format. 
`restrict(2)` throws only on a writer with less than 2 bytes of capacity left, 
and both callers pass a fresh 1024-byte writer. This says so with `noexcept`.
   
   A new `test_DbgCtl.cc` checks the `noexcept` at compile time (it fails to 
build without this change). It also checks at run time that a caller's format 
full of swoc brace syntax comes through byte for byte, with and without a debug 
tag, that a trailing newline is not doubled, and that a format longer than the 
buffer is truncated without throwing and still ends in a newline and a NUL.
   
   Tested with ASAN in the fedora:45 CI image: all 1421 unit tests, and 46 
Uranium tests for debug, diags, traffic_ctl and xdebug (43 passed, 3 skipped).
   


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