Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/hotspot/cpu/x86/stubGenerator_x86_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2534,6 +2534,10 @@ address StubGenerator::generate_base64_decodeBlock() {
__ BIND(L_finalBit);
// Now have 1 to 63 bytes left to decode

// A padded Base64 tail shorter than one complete block is handled by Java.
__ cmpl(length, 4);
__ jcc(Assembler::less, L_bruteForce);

// I was going to let Java take care of the final fragment
// however it will repeatedly call this routine for every 4 bytes
// of input data, so handle the rest here.
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/opto/c2compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,12 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method) {
break;
case vmIntrinsics::_compress_i:
case vmIntrinsics::_compress_l:
if (!Matcher::match_rule_supported(Op_CompressBits)) return false;
break;
// disable because of JDK-8350896
return false;
case vmIntrinsics::_expand_i:
case vmIntrinsics::_expand_l:
if (!Matcher::match_rule_supported(Op_ExpandBits)) return false;
break;
// disable because of JDK-8350896
return false;
case vmIntrinsics::_numberOfLeadingZeros_i:
if (!Matcher::match_rule_supported(Op_CountLeadingZerosI)) return false;
break;
Expand Down
10 changes: 10 additions & 0 deletions src/hotspot/share/opto/loopnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4256,6 +4256,7 @@ const TypeInt* PhaseIdealLoop::filtered_type( Node *n, Node* n_ctrl) {
Node* region = phi->in(0);
assert(n_ctrl == nullptr || n_ctrl == region, "ctrl parameter must be region");
if (region && region != C->top()) {
// Compute the union over the types of the paths/inputs.
for (uint i = 1; i < phi->req(); i++) {
Node* val = phi->in(i);
Node* use_c = region->in(i);
Expand All @@ -4266,10 +4267,17 @@ const TypeInt* PhaseIdealLoop::filtered_type( Node *n, Node* n_ctrl) {
} else {
filtered_t = filtered_t->meet(val_t)->is_int();
}
} else {
// We found no constriant, so we have to assume that this path
// is unconstrained, i.e. it could have the whole int range.
filtered_t = TypeInt::INT;
}
}
}
}

// The filtered type may be worse than what we already know
// about n, so take the intersection.
const TypeInt* n_t = _igvn.type(n)->is_int();
if (filtered_t != nullptr) {
n_t = n_t->join(filtered_t)->is_int();
Expand All @@ -4280,6 +4288,8 @@ const TypeInt* PhaseIdealLoop::filtered_type( Node *n, Node* n_ctrl) {

//------------------------------filtered_type_from_dominators--------------------------------
// Return a possibly more restrictive type for val based on condition control flow of dominators
// Note: we can also return "nullptr", which means "no constraint", and should be interpreted
// as if we returned TypeInt::INT.
const TypeInt* PhaseIdealLoop::filtered_type_from_dominators( Node* val, Node *use_ctrl) {
if (val->is_Con()) {
return val->bottom_type()->is_int();
Expand Down
54 changes: 43 additions & 11 deletions src/java.base/share/classes/java/lang/AbstractStringBuilder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2026, 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
Expand Down Expand Up @@ -236,6 +236,9 @@ public void ensureCapacity(int minimumCapacity) {
* overflow, this method throws {@code OutOfMemoryError}.
*/
private void ensureCapacityInternal(int minimumCapacity) {
if ((minimumCapacity & (Integer.MIN_VALUE >> coder)) != 0) {
throwExcessiveLengthError();
}
// overflow-conscious code
int oldCapacity = value.length >> coder;
if (minimumCapacity - oldCapacity > 0) {
Expand Down Expand Up @@ -1866,15 +1869,18 @@ long prepend(long lengthCoder, byte[] buffer) {
}

private AbstractStringBuilder repeat(char c, int count) {
int limit = this.count + count;
ensureCapacityInternal(limit);
final int limit;
boolean isLatin1 = isLatin1();
if (isLatin1 && StringLatin1.canEncode(c)) {
limit = repeatLimit(LATIN1, this.count, 1, count);
ensureCapacityInternal(limit);
Arrays.fill(value, this.count, limit, (byte)c);
} else {
if (isLatin1) {
inflate();
}
limit = repeatLimit(UTF16, this.count, 1, count);
ensureCapacityInternal(limit);
for (int index = this.count; index < limit; index++) {
StringUTF16.putCharSB(value, index, c);
}
Expand Down Expand Up @@ -1961,22 +1967,48 @@ public AbstractStringBuilder repeat(CharSequence cs, int count) {
return repeat(cs.charAt(0), count);
}
int offset = this.count;
int valueLength = length << coder;
if ((Integer.MAX_VALUE - offset) / count < valueLength) {
throw new OutOfMemoryError("Required length exceeds implementation limit");
}
int total = count * length;
int limit = offset + total;
ensureCapacityInternal(limit);
if (cs instanceof String str) {
ensureCapacityInternal(offset + length);
putStringAt(offset, str);
} else if (cs instanceof AbstractStringBuilder asb) {
append(asb);
} else {
ensureCapacityInternal(offset + length);
appendChars(cs, 0, length);
}
String.repeatCopyRest(value, offset << coder, total << coder, length << coder);
int limit = repeatLimit(coder, offset, length, count);
ensureCapacityInternal(limit);
String.repeatCopyRest(value, offset << coder, (count * length) << coder, length << coder);
this.count = limit;
return this;
}

/**
* {@return the new {@linkplain #count length} (in {@code char}s) after
* appending the given sequence with specified repetitions}
*
* @param coder the {@linkplain #coder coder} that will be used for encoding
* @param offset the {@linkplain #count offset} (in {@code char}s) to start appending at
* @param seqLength the length in {@code char}s of the sequence to be repeated
* @param seqRepetition the repetition count
*
* @throws OutOfMemoryError If the resultant length is out of bounds
*/
private static int repeatLimit(int coder, int offset, int seqLength, int seqRepetition) {
assert offset >= 0 : "Invalid offset: " + offset;
assert seqLength >= 0 : "Invalid sequence length: " + seqLength;
assert seqRepetition >= 0 : "Invalid sequence repetition count: " + seqRepetition;
long repeatedSeqLength = (long) seqLength * seqRepetition;
long limit = (long) offset + repeatedSeqLength;
long encodedLimit = limit << coder;
if (limit < 0 || encodedLimit < 0 || encodedLimit >= Integer.MAX_VALUE) {
throwExcessiveLengthError();
}
return (int) limit;
}

private static void throwExcessiveLengthError() {
throw new OutOfMemoryError("Required length exceeds implementation limit");
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2025, 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
Expand Down Expand Up @@ -37,6 +37,7 @@

import sun.security.util.Debug;
import sun.security.util.DisabledAlgorithmConstraints;
import sun.security.util.KeyUtil;
import sun.security.validator.Validator;
import sun.security.x509.AlgorithmId;
import sun.security.x509.X509CertImpl;
Expand Down Expand Up @@ -206,7 +207,8 @@ public void check(Certificate cert,
CertPathConstraintsParameters cp =
new CertPathConstraintsParameters(trustedPubKey, variant,
anchor, date);
dac.permits(trustedPubKey.getAlgorithm(), cp, true);
dac.permits(KeyUtil.getAlgorithm(trustedPubKey),
cp, true);
}
// Check the signature algorithm and parameters against constraints
CertPathConstraintsParameters cp =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2026, 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
Expand Down Expand Up @@ -201,6 +201,15 @@ class DHServerKeyExchangeMessage extends HandshakeMessage {
}

if (x509Credentials == null) {
// Only anonymous key exchange is unsigned. For any other
// cipher suite the server Certificate message must have been
// received before the ServerKeyExchange message.
if (!chc.negotiatedCipherSuite.isAnonymous()) {
throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
"No X.509 credentials negotiated for " +
"DH ServerKeyExchange: missing Certificate");
}

// anonymous, no authentication, no signature
if (m.hasRemaining()) {
throw chc.conContext.fatal(Alert.HANDSHAKE_FAILURE,
Expand Down
Loading
Loading