Bug 187382

Summary: [Crash] Illegal use of uninitialized std::optional value in WebCore::AnimationBase::updateStateMachine
Product: WebKit Reporter: Frédéric Wang (:fredw) <fred.wang>
Component: AnimationsAssignee: Frédéric Wang (:fredw) <fred.wang>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, commit-queue, dino, dstockwell, ews-watchlist, graouts, mcatanzaro, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=186536
Attachments:
Description Flags
Patch none

Description Frédéric Wang (:fredw) 2018-07-06 02:10:00 PDT
See bug 186536 comment 41 for a repro case with Google drive and stack trace. With the patch from bug 186536, the crash happens here:

        case AnimationState::PausedWaitTimer:
            ASSERT(input == AnimationStateInput::PlayStateRunning);
            ASSERT(paused());
            // Update the times
            m_startTime = m_startTime.value(0) + beginAnimationUpdateTime() - m_pauseTime.value_or(0);
            m_pauseTime = std::nullopt;

Checking other potential misuses of uninitialized std::optional members in AnimationBase::updateStateMachine(), I only see one possible other place.

I'll just use value_or(0) for these two places to workaround these issues. Antoine Quint mentioned that the old animation code is going to be removed soon, so the actual way we fix these should not be a big deal...
Comment 1 Frédéric Wang (:fredw) 2018-07-06 02:15:29 PDT
Created attachment 344410 [details]
Patch
Comment 2 WebKit Commit Bot 2018-07-06 03:10:56 PDT
Comment on attachment 344410 [details]
Patch

Clearing flags on attachment: 344410

Committed r233574: <https://trac.webkit.org/changeset/233574>
Comment 3 WebKit Commit Bot 2018-07-06 03:10:58 PDT
All reviewed patches have been landed.  Closing bug.
Comment 4 Radar WebKit Bug Importer 2018-07-06 03:12:23 PDT
<rdar://problem/41885732>