Fix unsigned overflow in Debug::Block dtor

Signed-off-by: mio <stigma@disroot.org>
(cherry picked from commit 956d90f8cb)
r14.1.x
mio 2 months ago committed by Michele Calgaro
parent 7258a83bf4
commit 09dcfc68c8
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -194,7 +194,10 @@ namespace Debug LIBAMAROK_EXPORT
double duration = double(end.tv_sec) + (double(end.tv_usec) / 1000000.0);
Debug::modifieableIndent().truncate( Debug::indent().length() - 2 );
// Prevent overflow that causes UINT_MAX allocation.
uint newLength = (Debug::indent().length() < 2) ? 0 : (Debug::indent().length() - 2);
Debug::modifieableIndent().truncate( newLength );
kdDebug() << "END__: " << m_label
<< " - Took " << TQString::number( duration, 'g', 2 ) << "s\n";
mutex.unlock();

Loading…
Cancel
Save