Skip to content

Commit

Permalink
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -232,12 +232,12 @@ public Object stringByteSubstring(RubyString string, int index, int length) {
rangeEnd = bytes.length();
}

if (normalizedIndex < bytes.getBegin()) {
if (normalizedIndex + bytes.begin() < bytes.begin()) {
return nil();
}

final byte[] copiedBytes = Arrays.copyOfRange(bytes.getUnsafeBytes(), normalizedIndex, rangeEnd);
final RubyBasicObject result = StringNodes.createString(string.getLogicalClass(), new ByteList(copiedBytes, StringNodes.getByteList(string).getEncoding()));
final byte[] copiedBytes = Arrays.copyOfRange(bytes.getUnsafeBytes(), normalizedIndex + bytes.begin(), rangeEnd + bytes.begin());
final RubyBasicObject result = StringNodes.createString(string.getLogicalClass(), new ByteList(copiedBytes, bytes.getEncoding()));

return taintResultNode.maybeTaint(string, result);
}

0 comments on commit e8cc0d9

Please sign in to comment.