mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-25 23:44:35 +00:00
Check if source location counts are in order when loading traces.
This commit is contained in:
parent
b262cb2428
commit
762582357b
@ -33,6 +33,7 @@
|
||||
#include "../public/common/TracyVersion.hpp"
|
||||
#include "TracyFileRead.hpp"
|
||||
#include "TracyFileWrite.hpp"
|
||||
#include "TracyPrint.hpp"
|
||||
#include "TracySort.hpp"
|
||||
#include "TracyTaskDispatch.hpp"
|
||||
#include "TracyWorker.hpp"
|
||||
@ -776,6 +777,13 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks, bool allow
|
||||
m_data.externalThreadCompress.Load( f );
|
||||
|
||||
f.Read( sz );
|
||||
if( sz > std::numeric_limits<int16_t>::max() )
|
||||
{
|
||||
s_loadProgress.total.store( 0, std::memory_order_relaxed );
|
||||
char buf[256];
|
||||
sprintf( buf, "Too many static source locations (%s)", RealToString( sz ) );
|
||||
throw LoadFailure( buf );
|
||||
}
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
{
|
||||
uint64_t ptr;
|
||||
@ -792,6 +800,13 @@ Worker::Worker( FileRead& f, EventType::Type eventMask, bool bgTasks, bool allow
|
||||
const auto sle = sz;
|
||||
|
||||
f.Read( sz );
|
||||
if( sz > std::numeric_limits<int16_t>::max() )
|
||||
{
|
||||
s_loadProgress.total.store( 0, std::memory_order_relaxed );
|
||||
char buf[256];
|
||||
sprintf( buf, "Too many dynamic source locations (%s)", RealToString( sz ) );
|
||||
throw LoadFailure( buf );
|
||||
}
|
||||
m_data.sourceLocationPayload.reserve_exact( sz, m_slab );
|
||||
for( uint64_t i=0; i<sz; i++ )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user