aws / dcv-color-primitives

DCV Color Primitives Library
MIT No Attribution
30 stars 22 forks source link

`dcv_color_primitives::initialize` allows data race in safe code #66

Closed 5225225 closed 1 year ago

5225225 commented 2 years ago

The function internally modifies/reads a global static mut, so as the docs correctly point out, it is UB to call this in a race with anything that uses it.

But the function then needs to be marked as unsafe.

Or, probably better yet, I'd use the crates lazy_static or once_cell (The functionality of once_cell is being added to the standard library, but is currently unstable) to lazily init as needed on function calls.

fabiosky commented 1 year ago

Classifying as 'bug' as it is a potential bug.