forge
Explore
Log in

Don't you dare go Hollow

B17: cros-libva config: query_surface_attributes wrote through a *const cast (UB); use let mut attrs_len and &mut

Browse files at this commit

bc8bcf27e0654ca9174c876f9f28b5f39c5cc1e0Ahmet Kaan GümüşParent: 22f0f3f
shims/cros-libva/src/config.rsmodified+3 -3
@@ -74,13 +74,13 @@ impl Config {
7474 // Safe because `self` represents a valid VAConfig. We first query how
7575 // much space is needed by the C API by passing in NULL in the first
7676 // call to `vaQuerySurfaceAttributes`.
77- let attrs_len: std::os::raw::c_uint = 0;
77+ let mut attrs_len: std::os::raw::c_uint = 0;
7878 va_check(unsafe {
7979 bindings::vaQuerySurfaceAttributes(
8080 self.display.handle(),
8181 self.id,
8282 std::ptr::null_mut(),
83- &attrs_len as *const _ as *mut std::os::raw::c_uint,
83+ &mut attrs_len,
8484 )
8585 })?;
8686
@@ -93,7 +93,7 @@ impl Config {
9393 self.display.handle(),
9494 self.id,
9595 attrs.as_mut_ptr(),
96- &attrs_len as *const _ as *mut std::os::raw::c_uint,
96+ &mut attrs_len,
9797 )
9898 })?;
9999