From bfdb84b101200d1b51f4d7d316324992267415c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Fri, 4 Jan 2019 17:57:39 +0100 Subject: [PATCH] Fix segfault due to memcpy (#155) Fixes failing tests on Linux and OSX --- src/mxarray.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mxarray.jl b/src/mxarray.jl index 8b1d138..d0bb252 100644 --- a/src/mxarray.jl +++ b/src/mxarray.jl @@ -312,7 +312,7 @@ function _copy_sparse_mat(a::SparseMatrixCSC{V,I}, ir_p::Ptr{mwIndex}, jc_p::Ptr jc[i] = colptr[i] - 1 end - ccall(:memcpy, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, UInt), pr_p, v, nnz*sizeof(V)) + copyto!(unsafe_wrap(Array, pr_p, (nnz,)), v) end function mxarray(a::SparseMatrixCSC{V,I}) where {V<:Union{Float64,Bool},I}