diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index ddddf219..2265026b 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -3326,6 +3326,12 @@ void Worker::NewSourceLocation( uint64_t ptr ) { static const SourceLocation emptySourceLocation = {}; + if( m_data.sourceLocation.size() > std::numeric_limits::max() ) + { + SourceLocationOverflowFailure(); + return; + } + m_data.sourceLocation.emplace( ptr, emptySourceLocation ); m_pendingSourceLocation++; m_sourceLocationQueue.push_back( ptr ); @@ -3708,6 +3714,11 @@ void Worker::AddSourceLocationPayload( const char* data, size_t sz ) auto slptr = m_slab.Alloc(); memcpy( slptr, &srcloc, sizeof( srcloc ) ); uint32_t idx = m_data.sourceLocationPayload.size(); + if( idx+1 > std::numeric_limits::max() ) + { + SourceLocationOverflowFailure(); + return; + } m_data.sourceLocationPayloadMap.emplace( slptr, idx ); m_pendingSourceLocationPayload = -int16_t( idx + 1 ); m_data.sourceLocationPayload.push_back( slptr );