You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously, we tried to check against the possibility that C code calls
rustls_client_config_free twice. We did this by doing `Arc::from_raw`,
then checking if strong_count is < 1.
However, this was undefined behavior: deferencing a dangling pointer.
https://doc.rust-lang.org/reference/behavior-considered-undefined.html
If strong_count went to zero on some previous call, `Arc` would have
dropped its contents. That means the pointed-to memory is no longer
valid to access, and its contents are undefined. So we might see
strong_count of 1,000,000, or -1,000,000, or any other value; or monkeys
could fly out of our noses.
The C caller can still invoke undefined behavior by calling
`rustls_client_config_free` twice, but the previous change tried to
detect undefined behavior by invoking undefined behavior, which doesn't
work.
0 commit comments