Diffusion KWin ab3d7d5277d2

[colorcorrection] Fix division by zero

Authored by zzag on Sep 12 2019, 6:38 PM.

Description

[colorcorrection] Fix division by zero

Summary:
m_currentTemp can be equal to targetTemp when resetSlowUpdateTimer is
called. resetSlowUpdateTimer doesn't handle that case, which results
in an FP exception being raised:

==20103==ERROR: AddressSanitizer: FPE on unknown address 0x7f40857d5ca6 (pc 0x7f40857d5ca6 bp 0x7ffccd95c330 sp 0x7ffccd95c220 T0)
    #0 0x7f40857d5ca5 in KWin::ColorCorrect::Manager::resetSlowUpdateTimer() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/colorcorrection/manager.cpp:417
    #1 0x7f40857d521d in KWin::ColorCorrect::Manager::resetSlowUpdateStartTimer() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/colorcorrection/manager.cpp:388
    #2 0x7f40857d42d5 in KWin::ColorCorrect::Manager::resetQuickAdjustTimer() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/colorcorrection/manager.cpp:324
    #3 0x7f40857d3ac1 in KWin::ColorCorrect::Manager::resetAllTimers() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/colorcorrection/manager.cpp:286
    #4 0x7f40857d0311 in KWin::ColorCorrect::Manager::hardReset() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/colorcorrection/manager.cpp:152
    #5 0x7f40857d038d in KWin::ColorCorrect::Manager::reparseConfigAndReset() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/colorcorrection/manager.cpp:159
    #6 0x420e75 in ColorCorrectNightColorTest::testConfigRead() /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/colorcorrect_nightcolor_test.cpp:126
    #7 0x4326b4 in ColorCorrectNightColorTest::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/autotests/integration/testColorCorrectNightColor_waylandonly_autogen/include/colorcorrect_nightcolor_test.moc:98
    #8 0x7f407a80a94a in QMetaMethod::invoke(QObject*, Qt::ConnectionType, QGenericReturnArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument, QGenericArgument) const (/usr/lib64/libQt5Core.so.5+0x29694a)
    #9 0x7f40840a8962  (/usr/lib64/libQt5Test.so.5+0x19962)
    #10 0x7f40840a9352  (/usr/lib64/libQt5Test.so.5+0x1a352)
    #11 0x7f40840a9910  (/usr/lib64/libQt5Test.so.5+0x1a910)
    #12 0x7f40840a9cda in QTest::qRun() (/usr/lib64/libQt5Test.so.5+0x1acda)
    #13 0x7f40840a9edb in QTest::qExec(QObject*, int, char**) (/usr/lib64/libQt5Test.so.5+0x1aedb)
    #14 0x432428 in main /home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/autotests/integration/colorcorrect_nightcolor_test.cpp:338
    #15 0x7f407a095bca in __libc_start_main (/lib64/libc.so.6+0x26bca)
    #16 0x413ea9 in _start (/home/jenkins/workspace/Plasma/kwin/kf5-qt5 SUSEQt5.12/build/bin/testColorCorrectNightColor_waylandonly+0x413ea9)

Reviewers: KWin, davidedmundson

Reviewed By: KWin, davidedmundson

Subscribers: kwin

Tags: KWin

Differential Revision: https://phabricator.kde.org/D23914

Details

Committed
zzagSep 13 2019, 7:48 AM
Reviewer
KWin
Differential Revision
D23914: [colorcorrection] Fix division by zero
Parents
R108:4b83556a4de9: SVN_SILENT made messages (.desktop file) - always resolve ours
Branches
Unknown
Tags
Unknown