Fix possible div-by-zero.

If as.ipMaxAsm.local is 0 and m_childCalls is false, GetHotnessColor(count, 0)
performs float(2 * count) / 0. The old code explicitly guarded against this
with the as.ipMaxAsm.local != 0 check.
This commit is contained in:
Bartosz Taudul
2026-05-23 13:33:16 +02:00
parent f63c25fb79
commit f99a02505a

View File

@@ -2775,7 +2775,7 @@ uint64_t SourceView::RenderSymbolAsmView( const AddrStatData& as, Worker& worker
const auto x60 = round( rect.Min.x + rect.GetWidth() * 0.6f );
for( size_t i=0; i<buckets.size(); i++ )
{
if( buckets[i] < 0 ) continue;
if( buckets[i] <= 0 ) continue;
const auto y0 = round( rect.Min.y + float( i ) / bucketNum * rect.GetHeight() );
const auto y1 = round( rect.Min.y + float( i + 1 ) / bucketNum * rect.GetHeight() );
const auto color = GetHotnessColor( buckets[i], m_childCalls ? (as.ipMaxAsm.local + as.ipMaxAsm.ext) : as.ipMaxAsm.local );