I have the same concern. Can we fix the immediate problem in 9 and
integrate verification logic in 10?


OK, Tobias is suggesting having verification logic only inside the
intrinsics.  Are you suggesting removing that as well?

Yes and put them back in 10.

I'm OK with removing all the verification, but that won't reduce the
library changes much.  I could undo the renaming to Trusted.getChar, but
we would still have the bounds checks moved into StringUTF16.

I suggest to go with a point fix for 9: just add missing range checks.

Is AbstractStringBuilder.append() the only affected method? (Sorry, it's hard to say exactly where the problem is by looking at the diff.)

I really like the refactoring you propose on jdk side, but there are pieces I'm not sure about. For example, I spotted a repeated range check:

jdk/src/java.base/share/classes/java/lang/AbstractStringBuilder.java:
    public void setCharAt(int index, char ch) {
        checkIndex(index, count);
        if (isLatin1() && StringLatin1.canEncode(ch)) {
            value[index] = (byte)ch;
        } else {
            if (isLatin1()) {
                inflate();
            }
            StringUTF16.putCharSB(value, index, ch);
        }
    }

Best regards,
Vladimir Ivanov

Reply via email to