mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8158168: Missing bounds checks for some String intrinsics
Reviewed-by: vlivanov, thartmann, sherman
This commit is contained in:
parent
456c8e0846
commit
73551c45ef
7 changed files with 417 additions and 254 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -36,7 +36,6 @@ import jdk.internal.HotSpotIntrinsicCandidate;
|
|||
import static java.lang.String.LATIN1;
|
||||
import static java.lang.String.UTF16;
|
||||
import static java.lang.String.checkOffset;
|
||||
import static java.lang.String.checkBoundsOffCount;
|
||||
|
||||
final class StringLatin1 {
|
||||
|
||||
|
@ -566,11 +565,7 @@ final class StringLatin1 {
|
|||
// inflatedCopy byte[] -> byte[]
|
||||
@HotSpotIntrinsicCandidate
|
||||
public static void inflate(byte[] src, int srcOff, byte[] dst, int dstOff, int len) {
|
||||
// We need a range check here because 'putChar' has no checks
|
||||
checkBoundsOffCount(dstOff << 1, len << 1, dst.length);
|
||||
for (int i = 0; i < len; i++) {
|
||||
StringUTF16.putChar(dst, dstOff++, src[srcOff++] & 0xff);
|
||||
}
|
||||
StringUTF16.inflate(src, srcOff, dst, dstOff, len);
|
||||
}
|
||||
|
||||
static class CharsSpliterator implements Spliterator.OfInt {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue