Bug 217271 - std::once_flag must be allocated in static storage
Summary: std::once_flag must be allocated in static storage
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-10-02 19:44 PDT by Yusuke Suzuki
Modified: 2020-10-05 09:26 PDT (History)
8 users (show)

See Also:


Attachments
Patch (7.57 KB, patch)
2020-10-02 19:48 PDT, Yusuke Suzuki
mark.lam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yusuke Suzuki 2020-10-02 19:44:17 PDT
std::once_flag must be allocated in static storage
Comment 1 Yusuke Suzuki 2020-10-02 19:48:21 PDT
Created attachment 410407 [details]
Patch
Comment 2 Mark Lam 2020-10-02 20:19:21 PDT
Comment on attachment 410407 [details]
Patch

r=me
Comment 3 Mark Lam 2020-10-02 20:24:41 PDT
Comment on attachment 410407 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=410407&action=review

> Source/WebCore/ChangeLog:8
> +        Since std::once_flag is an usual variable, this does not prevent us from calling it multiple times.

Did you mean "If the std::once_flag is a non-static variable, it will not prevent ..."?
Comment 4 Yusuke Suzuki 2020-10-02 23:00:30 PDT
Committed r267917: <https://trac.webkit.org/changeset/267917>
Comment 5 Yusuke Suzuki 2020-10-02 23:00:52 PDT
Comment on attachment 410407 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=410407&action=review

>> Source/WebCore/ChangeLog:8
>> +        Since std::once_flag is an usual variable, this does not prevent us from calling it multiple times.
> 
> Did you mean "If the std::once_flag is a non-static variable, it will not prevent ..."?

Fixed.
Comment 6 Radar WebKit Bug Importer 2020-10-02 23:01:15 PDT
<rdar://problem/69908537>
Comment 7 Darin Adler 2020-10-03 10:36:23 PDT
Comment on attachment 410407 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=410407&action=review

> Source/WebCore/platform/text/TextCodecSingleByte.cpp:180
> -    std::once_flag once;
> +    static std::once_flag once;

Oops, guess it was me who made this mistake. Thank you for fixing it!
Comment 8 David Kilzer (:ddkilzer) 2020-10-05 09:26:05 PDT
Sadly, I believe this is caught by the clang static analyzer as well.