Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix growToHold() bug in serializer.
  • Loading branch information
jnthn committed Apr 14, 2013
1 parent 8d540e0 commit 529ee92
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/org/perl6/nqp/sixmodel/SerializationWriter.java
Expand Up @@ -709,9 +709,13 @@ private void serializeContext(CallFrame cf) {
/* Grows a buffer as needed to hold more data. */
private void growToHold(int idx, int required) {
ByteBuffer check = this.outputs[idx];
if (check.position() + required >= check.capacity()) {
int position = check.position();
if (position + required >= check.capacity()) {
ByteBuffer replacement = ByteBuffer.allocate(check.capacity() * 2);
replacement.order(ByteOrder.LITTLE_ENDIAN);
check.position(0);
replacement.put(check);
replacement.position(position);
this.outputs[idx] = replacement;
}
}
Expand Down

0 comments on commit 529ee92

Please sign in to comment.