B17: cros-libva config: query_surface_attributes wrote through a *const cast (UB); use let mut attrs_len and &mut
Browse files at this commitbc8bcf27e0654ca9174c876f9f28b5f39c5cc1e0Parent: 22f0f3f1 changed file +3 -3
shims/cros-libva/src/config.rsmodified+3 -3
| @@ -74,13 +74,13 @@ impl Config { | |||
| 74 | // Safe because `self` represents a valid VAConfig. We first query how | 74 | // Safe because `self` represents a valid VAConfig. We first query how |
| 75 | // much space is needed by the C API by passing in NULL in the first | 75 | // much space is needed by the C API by passing in NULL in the first |
| 76 | // call to `vaQuerySurfaceAttributes`. | 76 | // call to `vaQuerySurfaceAttributes`. |
| 77 | - let attrs_len: std::os::raw::c_uint = 0; | 77 | + let mut attrs_len: std::os::raw::c_uint = 0; |
| 78 | va_check(unsafe { | 78 | va_check(unsafe { |
| 79 | bindings::vaQuerySurfaceAttributes( | 79 | bindings::vaQuerySurfaceAttributes( |
| 80 | self.display.handle(), | 80 | self.display.handle(), |
| 81 | self.id, | 81 | self.id, |
| 82 | std::ptr::null_mut(), | 82 | std::ptr::null_mut(), |
| 83 | - &attrs_len as *const _ as *mut std::os::raw::c_uint, | 83 | + &mut attrs_len, |
| 84 | ) | 84 | ) |
| 85 | })?; | 85 | })?; |
| 86 | 86 | ||
| @@ -93,7 +93,7 @@ impl Config { | |||
| 93 | self.display.handle(), | 93 | self.display.handle(), |
| 94 | self.id, | 94 | self.id, |
| 95 | attrs.as_mut_ptr(), | 95 | attrs.as_mut_ptr(), |
| 96 | - &attrs_len as *const _ as *mut std::os::raw::c_uint, | 96 | + &mut attrs_len, |
| 97 | ) | 97 | ) |
| 98 | })?; | 98 | })?; |
| 99 | 99 | ||