Skip to content

Commit 0251776

Browse files
lukasstadlerfangerer
authored andcommitted
fix length of data copied in SequenceStorageNodes
1 parent eb93f91 commit 0251776

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/common/SequenceStorageNodes.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2866,7 +2866,8 @@ static NativeSequenceStorage doNativeByte(Node node, NativeSequenceStorage s, @S
28662866
@Cached CStructAccess.WriteByteNode write,
28672867
@Cached CStructAccess.FreeNode free,
28682868
@Shared @Cached PRaiseNode.Lazy raiseNode) {
2869-
if (cap > s.getCapacity()) {
2869+
int capacity = s.getCapacity();
2870+
if (cap > capacity) {
28702871
int newCapacity;
28712872
try {
28722873
newCapacity = Math.max(16, PythonUtils.multiplyExact(cap, 2));
@@ -2881,7 +2882,7 @@ static NativeSequenceStorage doNativeByte(Node node, NativeSequenceStorage s, @S
28812882
throw raiseNode.get(inliningTarget).raise(MemoryError);
28822883
}
28832884
// TODO: turn this into a memcpy
2884-
for (long i = 0; i < bytes; i++) {
2885+
for (long i = 0; i < capacity; i++) {
28852886
write.writeArrayElement(newMem, i, read.readArrayElement(mem, i));
28862887
}
28872888
free.free(mem);

0 commit comments

Comments
 (0)