diff options
| author | mio <stigma@disroot.org> | 2024-09-28 22:38:37 +1000 |
|---|---|---|
| committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-09-28 22:15:27 +0900 |
| commit | 09dcfc68c84c9b7eacb53648c4c099e074143cd7 (patch) | |
| tree | 71c5b5f2190ca36b69ea784a41dba763004220cb | |
| parent | 7258a83bf4c05dc4e5a1e80c30ac7267840e4ba2 (diff) | |
| download | amarok-09dcfc68.tar.gz amarok-09dcfc68.zip | |
Fix unsigned overflow in Debug::Block dtor
Signed-off-by: mio <stigma@disroot.org>
(cherry picked from commit 956d90f8cb5e5324c405ef3405b45a34d9c41d29)
| -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(); |
