[Webkit-unassigned] [Bug 210625] New: [iOS WK1] -[_WebSafeForwarder asyncForwarder] uses non-static dispatch_once_t predicate

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Apr 16 16:15:02 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=210625

            Bug ID: 210625
           Summary: [iOS WK1] -[_WebSafeForwarder asyncForwarder] uses
                    non-static dispatch_once_t predicate
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKit Misc.
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ddkilzer at webkit.org
                CC: darin at apple.com

-[_WebSafeForwarder asyncForwarder] uses non-static dispatch_once_t predicate.

@interface _WebSafeForwarder : NSObject
{
    id target; // Non-retained. Don't retain delegates.
    id defaultTarget;
#if PLATFORM(IOS_FAMILY)
    _WebSafeAsyncForwarder *asyncForwarder;
    dispatch_once_t asyncForwarderPred;
#endif
}

[...]

- (id)asyncForwarder
{
    dispatch_once(&asyncForwarderPred, ^{
        asyncForwarder = [[_WebSafeAsyncForwarder alloc] initWithForwarder:self];
    });
    return asyncForwarder;
}

Found by clang static analyzer:

Call to 'dispatch_once' uses the instance variable 'asyncForwarderPred' for the predicate value.  Using such transient memory for the predicate is potentially dangerous

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200416/49a88ef8/attachment.htm>


More information about the webkit-unassigned mailing list