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
{{ message }}
Repository navigation
get_channels_peak_values passes a read-only pointer to a call that writes through it #79
AudioMeterInformation::get_channels_peak_values calls GetChannelsPeakValues(&mut peaks) from the windows crate.
The generated wrapper converts the slice with transmute(afpeakvalues.as_ptr()).
The pointer comes from a shared reborrow, so it only has read-only provenance.
Windows writes the peak values through it, which is undefined behaviour.
This is the same pattern as microsoft/windows-rs#5189, where GetKeyboardState miscompiles in release builds.
That case is a stack array read at constant indices.
Here it's a heap Vec with a runtime length, so an actual miscompile is less likely, but it's still UB.
Affects v0.24.0 to v0.26.0.
The fix is to call the vtable entry directly with peaks.as_mut_ptr(), like GetChannelsPeakValuesSlice does on the drop-umbrella-windows branch (#74).
Activity