From 807ba80e04558b9b1da715d20af35cad11d7897d Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Mon, 19 Jul 2021 21:21:08 -0400 Subject: [PATCH] fix memory corruption in `deleteat!` n.b. `n == a->nrows + dec` Fixes https://github.com/JuliaData/DataFrames.jl/issues/2819 --- src/array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/array.c b/src/array.c index 778fb6d1e677c..43376d8ba222b 100644 --- a/src/array.c +++ b/src/array.c @@ -1119,7 +1119,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; }