Skip to content

Conversation

twesterhout
Copy link
Contributor

Instead of allocating an array of pointers, joinMany was allocating memory for just one pointer. This was making ArrayFire read out of bounds and fail with various errors.

This commit fixes this issue by adding a helper withManyForeignPtr function that acts like withForeignPtr (not unsafeWithForeignPtr!), but for a list of ForeignPtrs.

Instead of allocating an array of pointers, joinMany was allocating
memory for just one pointer. This was making ArrayFire read out of
bounds and fail with various errors.

This commit fixes this issue by adding a helper withManyForeignPtr
function that acts like withForeignPtr (not unsafeWithForeignPtr!), but
for a list of ForeignPtrs.
@dmjio
Copy link
Member

dmjio commented Aug 25, 2023

Thank you for fixing these bugs ! allocaArray /withArrayLen is definitely the right way to go.

af_err af_join_many(af_array *out, const int dim, const unsigned n_arrays, const af_array *inputs);

@dmjio dmjio merged commit 90812e0 into arrayfire:master Aug 25, 2023
@twesterhout twesterhout deleted the joinMany branch August 25, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants