Skip to content

Commit 073363c

Browse files
committed
Fix growToHold() bug in serializer.
1 parent 939c511 commit 073363c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/vm/jvm/runtime/org/perl6/nqp/sixmodel/SerializationWriter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,9 +709,13 @@ private void serializeContext(CallFrame cf) {
709709
/* Grows a buffer as needed to hold more data. */
710710
private void growToHold(int idx, int required) {
711711
ByteBuffer check = this.outputs[idx];
712-
if (check.position() + required >= check.capacity()) {
712+
int position = check.position();
713+
if (position + required >= check.capacity()) {
713714
ByteBuffer replacement = ByteBuffer.allocate(check.capacity() * 2);
715+
replacement.order(ByteOrder.LITTLE_ENDIAN);
716+
check.position(0);
714717
replacement.put(check);
718+
replacement.position(position);
715719
this.outputs[idx] = replacement;
716720
}
717721
}

0 commit comments

Comments
 (0)