From 7841a660a8775e45a7c6edfc5064db353c874405 Mon Sep 17 00:00:00 2001 From: Seebs Date: Fri, 7 Feb 2020 12:39:31 -0600 Subject: [PATCH] make sure setArray isn't copying mapped data addresses by accident in unionInPlace --- roaring/roaring.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roaring/roaring.go b/roaring/roaring.go index 5992942c1..99a87a0d9 100644 --- a/roaring/roaring.go +++ b/roaring/roaring.go @@ -3779,7 +3779,10 @@ func unionArrayArrayInPlace(a, b *Container) *Container { // for InPlace, we actually want to ensure that // we update a, as long as it's not frozen. a = a.Thaw() - a.setArray(b.array()) + // ... but we also want to be sure we don't end up + // copying in a mapped object into our not-mapped + // object. + a.setArrayMaybeCopy(b.array(), b.Mapped()) return a.optimize() } return a