mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 07:54:36 +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 = {};
|
static const SourceLocation emptySourceLocation = {};
|
||||||
|
|
||||||
|
if( m_data.sourceLocation.size() > std::numeric_limits<int16_t>::max() )
|
||||||
|
{
|
||||||
|
SourceLocationOverflowFailure();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_data.sourceLocation.emplace( ptr, emptySourceLocation );
|
m_data.sourceLocation.emplace( ptr, emptySourceLocation );
|
||||||
m_pendingSourceLocation++;
|
m_pendingSourceLocation++;
|
||||||
m_sourceLocationQueue.push_back( ptr );
|
m_sourceLocationQueue.push_back( ptr );
|
||||||
@ -3708,6 +3714,11 @@ void Worker::AddSourceLocationPayload( const char* data, size_t sz )
|
|||||||
auto slptr = m_slab.Alloc<SourceLocation>();
|
auto slptr = m_slab.Alloc<SourceLocation>();
|
||||||
memcpy( slptr, &srcloc, sizeof( srcloc ) );
|
memcpy( slptr, &srcloc, sizeof( srcloc ) );
|
||||||
uint32_t idx = m_data.sourceLocationPayload.size();
|
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_data.sourceLocationPayloadMap.emplace( slptr, idx );
|
||||||
m_pendingSourceLocationPayload = -int16_t( idx + 1 );
|
m_pendingSourceLocationPayload = -int16_t( idx + 1 );
|
||||||
m_data.sourceLocationPayload.push_back( slptr );
|
m_data.sourceLocationPayload.push_back( slptr );
|
||||||
|
Loading…
Reference in New Issue
Block a user