Singleton lacks bounds on Send and Sync.
Moderate severity
GitHub Reviewed
Published
Aug 25, 2021
to the GitHub Advisory Database
•
Updated Jan 9, 2023
Withdrawn
This advisory was withdrawn on Aug 24, 2021
Description
Reviewed
Aug 6, 2021
Withdrawn
Aug 24, 2021
Published to the GitHub Advisory Database
Aug 25, 2021
Last updated
Jan 9, 2023
Singleton<T>
is meant to be a static object that can be initialized lazily. Inorder to satisfy the requirement that
static
items must implementSync
,Singleton
implemented bothSync
andSend
unconditionally.This allows for a bug where non-
Sync
types such asCell
can be used insingletons and cause data races in concurrent programs.
The flaw was corrected in commit
b0d2bd20e
by adding trait bounds, requiringthe contaiend type to implement
Sync
.References