From a643bf2d00b646868518221e489197700e0c6efb Mon Sep 17 00:00:00 2001
From: "raphael.bach" <raphael.bach@etu.hesge.ch>
Date: Tue, 28 Jun 2022 22:43:49 +0200
Subject: [PATCH] Add `assert()` in `fmpi_futhark.c`

---
 src/fmpi_futhark.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/fmpi_futhark.c b/src/fmpi_futhark.c
index 8233ac2..dc76a12 100644
--- a/src/fmpi_futhark.c
+++ b/src/fmpi_futhark.c
@@ -201,6 +201,7 @@ int fmpi_futhark_free_data_sync(
 ){
     assert(ctx != NULL);
     assert(data != NULL);
+    assert(dim_cnt <= FMPI_DIM_MAX);
     const size_t idx = FMPI_PRIV_FUTHARK_FUNC_IDX(dim_cnt, type);
     fmpi_futhark_free_data_func_list[idx](ctx, data);
     fmpi_futhark_sync(ctx);
@@ -216,6 +217,7 @@ int fmpi_futhark_free_data_async(
 ){
     assert(ctx != NULL);
     assert(data != NULL);
+    assert(dim_cnt <= FMPI_DIM_MAX);
     const size_t idx = FMPI_PRIV_FUTHARK_FUNC_IDX(dim_cnt, type);
     return fmpi_futhark_free_data_func_list[idx](ctx, data);
 }
-- 
GitLab