capi: check api is aligned

This commit is contained in:
chyyran 2023-01-14 00:27:35 -05:00
parent 403ed5ed13
commit 1fa85d1e4d
2 changed files with 5 additions and 3 deletions

View file

@ -194,12 +194,12 @@ impl LibrashaderError {
macro_rules! assert_non_null {
($value:ident) => {
if $value.is_null() {
if $value.is_null() || !$value.is_aligned() {
return $crate::error::LibrashaderError::InvalidParameter(stringify!($value)).export();
}
};
(noexport $value:ident) => {
if $value.is_null() {
if $value.is_null() || !$value.is_aligned() {
return Err($crate::error::LibrashaderError::InvalidParameter(
stringify!($value),
));
@ -234,5 +234,6 @@ macro_rules! assert_some_ptr {
use crate::ctypes::libra_error_t;
pub(crate) use assert_non_null;
// pub(crate) use assert_some;
pub(crate) use assert_some_ptr;

View file

@ -35,6 +35,7 @@
//! `libra_error_free`.
#![allow(non_camel_case_types)]
#![feature(try_blocks)]
#![feature(pointer_is_aligned)]
#![feature(vec_into_raw_parts)]
#![deny(unsafe_op_in_unsafe_fn)]