⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 233574 in webkit


Ignore:
Timestamp:
Jul 6, 2018, 3:10:50 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

[Crash] Illegal use of uninitialized std::optional value in WebCore::AnimationBase::updateStateMachine
​https://bugs.webkit.org/show_bug.cgi?id=187382

Patch by Frederic Wang <​fwang@igalia.com> on 2018-07-06
Reviewed by Carlos Garcia Campos.

WebCore::AnimationBase::updateStateMachine has two potential places where the use of an
uninitialized std:optional value is possible and one of them is hit when using Google drive.
Since that old animation code is going to be removed soon, we just quickly patch this issue
via value_or() so that we can restore the ASSERT added in bug 186536.

No new tests, code is going to be removed soon.

  • page/animation/AnimationBase.cpp:

(WebCore::AnimationBase::updateStateMachine): Use value_or(0) to avoid potential crashes.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r233572 r233574  
     12018-07-06  Frederic Wang  <fwang@igalia.com>
     2
     3        [Crash] Illegal use of uninitialized std::optional value in WebCore::AnimationBase::updateStateMachine
     4        https://bugs.webkit.org/show_bug.cgi?id=187382
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        WebCore::AnimationBase::updateStateMachine has two potential places where the use of an
     9        uninitialized std:optional value is possible and one of them is hit when using Google drive.
     10        Since that old animation code is going to be removed soon, we just quickly patch this issue
     11        via value_or() so that we can restore the ASSERT added in bug 186536.
     12
     13        No new tests, code is going to be removed soon.
     14
     15        * page/animation/AnimationBase.cpp:
     16        (WebCore::AnimationBase::updateStateMachine): Use value_or(0) to avoid potential crashes.
     17
    1182018-07-06  Frederic Wang  <fwang@igalia.com>
    219
  • trunk/Source/WebCore/page/animation/AnimationBase.cpp

    r232178 r233574  
    380380            ASSERT(paused());
    381381            // Update the times
    382             m_startTime = m_startTime.value() + beginAnimationUpdateTime() - m_pauseTime.value_or(0);
     382            m_startTime = m_startTime.value_or(0) + beginAnimationUpdateTime() - m_pauseTime.value_or(0);
    383383            m_pauseTime = std::nullopt;
    384384
    … …  
    412412                // Update the times
    413413                if (m_animationState == AnimationState::PausedRun)
    414                     m_startTime = m_startTime.value() + beginAnimationUpdateTime() - m_pauseTime.value_or(0);
     414                    m_startTime = m_startTime.value_or(0) + beginAnimationUpdateTime() - m_pauseTime.value_or(0);
    415415                else
    416416                    m_startTime = 0;
Note: See TracChangeset for help on using the changeset viewer.