mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +00:00
Hook up source location overflow failures.
Note: not tested. Expect some off-by-one bugs. Control flow may fail. Oh no.
This commit is contained in:
parent
54ee77026f
commit
586c6bf166
@ -3326,6 +3326,12 @@ void Worker::NewSourceLocation( uint64_t ptr )
|
||||
{
|
||||
static const SourceLocation emptySourceLocation = {};
|
||||
|
||||
if( m_data.sourceLocation.size() > std::numeric_limits<int16_t>::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<SourceLocation>();
|
||||
memcpy( slptr, &srcloc, sizeof( srcloc ) );
|
||||
uint32_t idx = m_data.sourceLocationPayload.size();
|
||||
if( idx+1 > std::numeric_limits<int16_t>::max() )
|
||||
{
|
||||
SourceLocationOverflowFailure();
|
||||
return;
|
||||
}
|
||||
m_data.sourceLocationPayloadMap.emplace( slptr, idx );
|
||||
m_pendingSourceLocationPayload = -int16_t( idx + 1 );
|
||||
m_data.sourceLocationPayload.push_back( slptr );
|
||||
|
Loading…
Reference in New Issue
Block a user