Merge pull request #6499 from sfc-gh-ajbeamon/fix-trace-overflow-bug

Fix possible infinite loop when a trace event is too long
This commit is contained in:
Trevor Clinkenbeard 2022-03-04 16:11:37 -08:00 committed by GitHub
commit b84d3af533
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1022,7 +1022,7 @@ BaseTraceEvent& BaseTraceEvent::detailImpl(std::string&& key, std::string&& valu
if (maxEventLength >= 0 && fields.sizeBytes() > maxEventLength) { if (maxEventLength >= 0 && fields.sizeBytes() > maxEventLength) {
TraceEvent(g_network && g_network->isSimulated() ? SevError : SevWarnAlways, "TraceEventOverflow") TraceEvent(g_network && g_network->isSimulated() ? SevError : SevWarnAlways, "TraceEventOverflow")
.setMaxEventLength(1000) .setMaxEventLength(1000)
.detail("TraceFirstBytes", fields.toString().substr(300)); .detail("TraceFirstBytes", fields.toString().substr(0, 300));
enabled = false; enabled = false;
} }
--g_allocation_tracing_disabled; --g_allocation_tracing_disabled;