Bug 254532

Summary: [CG] Building the dictionary of the async image decoding options is not thread safe
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: ImagesAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: sabouhallawa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Said Abou-Hallawa 2023-03-27 09:57:05 PDT
imageSourceThumbnailOptions() is called to build the dictionary of the async image decoding options. It uses the static variable `options` which is initialized the first time this function is called. If this function is called from multiple threads at the same time, more than one thread can see that the static variable `options` is initialized and may initialize it then. Setting the variable from these threads are not be atomic. So we may be end up with invalid pointer for this static variable.
Comment 1 Said Abou-Hallawa 2023-03-27 09:57:27 PDT
rdar://106302373
Comment 2 Said Abou-Hallawa 2023-03-27 10:01:20 PDT
Pull request: https://github.com/WebKit/WebKit/pull/12015
Comment 3 EWS 2023-03-27 14:40:44 PDT
Committed 262175@main (04196137234f): <https://commits.webkit.org/262175@main>

Reviewed commits have been landed. Closing PR #12015 and removing active labels.