From a6005e6905892cfccae5a6c747f29fb25b5c76d5 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Wed, 21 Jul 2021 12:15:12 -0400 Subject: [PATCH] fix memory corruption in `deleteat!` (#41646) n.b. `n == a->nrows + dec` Fixes https://github.com/JuliaData/DataFrames.jl/issues/2819 (cherry picked from commit 2e06a016fdad70736dd6c25c5a5286809e442b35) --- src/array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/array.c b/src/array.c index 20c6cf7706880..3218731d5a20b 100644 --- a/src/array.c +++ b/src/array.c @@ -1095,7 +1095,7 @@ STATIC_INLINE void jl_array_del_at_beg(jl_array_t *a, size_t idx, size_t dec, // Move the rest of the data if the offset changed if (newoffs != offset) { memmove_safe(a->flags.hasptr, newdata + nb1, olddata + nb1 + nbdec, nbtotal - nb1); - if (isbitsunion) memmove(newtypetagdata + idx, typetagdata + idx + dec, n - idx); + if (isbitsunion) memmove(newtypetagdata + idx, typetagdata + idx + dec, a->nrows - idx); } a->data = newdata; }