diff options
| author | mio <stigma@disroot.org> | 2024-09-28 22:38:37 +1000 |
|---|---|---|
| committer | mio <stigma@disroot.org> | 2024-09-28 22:38:37 +1000 |
| commit | 956d90f8cb5e5324c405ef3405b45a34d9c41d29 (patch) | |
| tree | 03eaa9e2c3405a0d272e3419e65a6adf72f7047c | |
| parent | 1d285726d1b4dc0224e0fa82cc3c8ad4d9304a83 (diff) | |
| download | amarok-956d90f8cb5e5324c405ef3405b45a34d9c41d29.tar.gz amarok-956d90f8cb5e5324c405ef3405b45a34d9c41d29.zip | |
Fix unsigned overflow in Debug::Block dtor
Signed-off-by: mio <stigma@disroot.org>
| -rw-r--r-- | amarok/src/debug.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/amarok/src/debug.h b/amarok/src/debug.h index 6fe48cc0..d212f9fe 100644 --- a/amarok/src/debug.h +++ b/amarok/src/debug.h @@ -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(); |
