RESOLVED FIXED 216085
WebCore::DOMTimerFireState constructor fails to initialize m_initialDOMTreeVersion, m_previous on worker threads
https://bugs.webkit.org/show_bug.cgi?id=216085
Summary WebCore::DOMTimerFireState constructor fails to initialize m_initialDOMTreeVe...
David Kilzer (:ddkilzer)
Reported 2020-09-02 11:27:24 PDT
WebCore::DOMTimerFireState fails to initialize m_initialDOMTreeVersion, m_previous on worker threads. Found by clang static analyzer using the optin.cplusplus.UninitializedObject checker.
Attachments
Patch v1 (1.38 KB, patch)
2020-09-02 11:32 PDT, David Kilzer (:ddkilzer)
darin: review+
Patch for landing (2.30 KB, patch)
2020-09-03 11:12 PDT, David Kilzer (:ddkilzer)
no flags
David Kilzer (:ddkilzer)
Comment 1 2020-09-02 11:32:14 PDT
Created attachment 407780 [details] Patch v1
Darin Adler
Comment 2 2020-09-02 21:34:01 PDT
Comment on attachment 407780 [details] Patch v1 View in context: https://bugs.webkit.org/attachment.cgi?id=407780&action=review > Source/WebCore/page/DOMTimer.cpp:100 > bool m_contextIsDocument; Why not initialize this to false, too? I know it’s not necessary, but seems worth doing. Keep in mind that those other two are never used when m_contextIsDocument is false, so all of this is just "defensive programming".
Darin Adler
Comment 3 2020-09-02 21:35:37 PDT
Another way to do this is to write the constructor differently, like this: , m_initialDOMTreeVersion(m_contextIsDocument ? downcast<Document>(context).domTreeVersion() : 0) , m_previous(m_contextIsDocument ? std::exchange(current, this) : nullptr) And reorder the members so m_contextIsDocument comes first.
David Kilzer (:ddkilzer)
Comment 4 2020-09-03 11:12:44 PDT
Created attachment 407894 [details] Patch for landing
David Kilzer (:ddkilzer)
Comment 5 2020-09-04 08:00:22 PDT
Comment on attachment 407894 [details] Patch for landing Adding cq+ since all bubbles passed.
EWS
Comment 6 2020-09-04 08:03:27 PDT
Committed r266608: <https://trac.webkit.org/changeset/266608> All reviewed patches have been landed. Closing bug and clearing flags on attachment 407894 [details].
Radar WebKit Bug Importer
Comment 7 2020-09-04 08:04:13 PDT
Note You need to log in before you can comment on or make changes to this bug.