From 683b77cab076c6280d0b7c60c644f7fdf97b1172 Mon Sep 17 00:00:00 2001 From: Justin Carpentier <justin.carpentier@inria.fr> Date: Sat, 7 Jan 2023 16:52:22 +0100 Subject: [PATCH] core: check data alignment --- include/eigenpy/eigen-allocator.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/eigenpy/eigen-allocator.hpp b/include/eigenpy/eigen-allocator.hpp index 650da8dd..589159d0 100644 --- a/include/eigenpy/eigen-allocator.hpp +++ b/include/eigenpy/eigen-allocator.hpp @@ -124,6 +124,9 @@ struct EigenAllocator { PyArrayObject *pyArray, boost::python::converter::rvalue_from_python_storage<MatType> *storage) { void *raw_ptr = storage->storage.bytes; + assert(is_aligned(raw_ptr, EIGENPY_DEFAULT_ALIGN_BYTES) && + "The pointer is not aligned."); + Type *mat_ptr = details::init_matrix_or_array<Type>::run(pyArray, raw_ptr); Type &mat = *mat_ptr; -- GitLab