Skip to content

Commit 5f4d86a

Browse files
author
Joel Dice
committed
avoid potential corruption in hashMapInsert due to table-resize-on-GC
1 parent 22a5707 commit 5f4d86a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/util.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,11 +380,12 @@ hashMapInsert(Thread* t, object map, object key, object value,
380380

381381
unsigned index = h & (arrayLength(t, array) - 1);
382382

383-
object n = makeTriple(t, k, value, arrayBody(t, array, index));
383+
object n = makeTriple(t, k, value, 0);
384384

385385
array = hashMapArray(t, map);
386386
index = h & (arrayLength(t, array) - 1);
387387

388+
set(t, n, TripleThird, arrayBody(t, array, index));
388389
set(t, array, ArrayBody + (index * BytesPerWord), n);
389390
}
390391

0 commit comments

Comments
 (0)