This commit is contained in:
Andrew John Hughes 2020-06-29 21:30:31 +01:00
commit 39688a6624
62 changed files with 654 additions and 352 deletions

View File

@ -952,3 +952,6 @@ a10060e929f5a243f9370042a4e19e40a28d8496 jdk8u262-b03
82ed4d90c434d1a7c70ab841dd87b984fa64cd9c jdk8u262-b05
4677f2e7bc8441c50e4ee9a34044551509d97dd4 jdk8u272-b00
3bc25a3c3df8c1cb27c48d11a7439c5c0bc39e80 jdk8u262-b06
3144a637f47b3086cb0a77a89ca4313bc5041c0a jdk8u262-b07
1b8f5ca08a94352590a76fe702bc2475e0c62057 jdk8u262-b08
66c9b9e4bce03972c2d587a58c20bf9c084206c4 jdk8u262-b09

View File

@ -1006,3 +1006,6 @@ bb464170d34478503661419d2f2864af7553d696 jdk8u252-b06
e1a42471eb39cb9340608238cd67b1938f73632e jdk8u262-b04
ecb485e1572c2f4964a943704fa6a79f8d5ee34c jdk8u262-b05
2f973e405849e5e5fbe1b95ad1f37dc19cd046bc jdk8u262-b06
4f5c1e68c85ec157a86505613e1aec3f4528957b jdk8u262-b07
59b2de0b2c60f7ae444a43c76fc96260351172a3 jdk8u262-b08
2bab25ddc567a2fe5038cb49cf5586dfb4c32ff2 jdk8u262-b09

View File

@ -1079,3 +1079,6 @@ ee99eeee44ad1b13088f8c70711668f0cdee7821 jdk8u252-b07
1d0763331a525db2b7281159d1325be53e17e898 jdk8u262-b04
61a6c87db285a79da7f90ac95916a591e95ba359 jdk8u262-b05
c4db66b4dcf7da619465874f9b87d7a3840fb239 jdk8u262-b06
7709711670b4f2994499684c4b4356e224764af9 jdk8u262-b07
839f2cd2a1817734a3aa39e5ce2980f0873722a9 jdk8u262-b08
ad521427e273fe14ea5d0cf6d1dc62c81148fd8b jdk8u262-b09

View File

@ -1312,3 +1312,6 @@ d17814ea88e3aa0a2f2fdb125e35a878ee27fe3e jdk8u252-b07
3a3803a0c789c4d09fd53e54760e7bb7d704ca6e jdk8u262-b04
f7691a80458c365b5dd754b1e117818144ed30f1 jdk8u262-b05
de6565b66f9458fb97eb66483e48f159b3f39d36 jdk8u262-b06
d20a5f399218f58f82f4f4503d24957ce7e48e60 jdk8u262-b07
d2c2cd90513e48822648ff16016aa76577eb7ab1 jdk8u262-b08
cf6e3496e19a2957f7d8b28bd0a033cefbf6509f jdk8u262-b09

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, 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
@ -135,6 +135,8 @@ void JfrCheckpointManager::register_service_thread(const Thread* thread) {
void JfrCheckpointManager::register_full(BufferPtr t, Thread* thread) {
// nothing here at the moment
assert(t != NULL, "invariant");
assert(t->acquired_by(thread), "invariant");
assert(t->retired(), "invariant");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2019, 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
@ -137,6 +137,14 @@ void JfrBuffer::clear_identity() {
_identity = NULL;
}
bool JfrBuffer::acquired_by(const void* id) const {
return identity() == id;
}
bool JfrBuffer::acquired_by_self() const {
return acquired_by(Thread::current());
}
#ifdef ASSERT
static bool validate_to(const JfrBuffer* const to, size_t size) {
assert(to != NULL, "invariant");
@ -154,10 +162,6 @@ static bool validate_this(const JfrBuffer* const t, size_t size) {
assert(t->top() + size <= t->pos(), "invariant");
return true;
}
bool JfrBuffer::acquired_by_self() const {
return identity() == Thread::current();
}
#endif // ASSERT
void JfrBuffer::move(JfrBuffer* const to, size_t size) {
@ -184,7 +188,6 @@ void JfrBuffer::concurrent_move_and_reinitialize(JfrBuffer* const to, size_t siz
set_concurrent_top(start());
}
// flags
enum FLAG {
RETIRED = 1,
TRANSIENT = 2,

View File

@ -57,7 +57,6 @@ class JfrBuffer {
u4 _size;
const u1* stable_top() const;
void clear_flags();
public:
JfrBuffer();
@ -150,6 +149,8 @@ class JfrBuffer {
void acquire(const void* id);
bool try_acquire(const void* id);
bool acquired_by(const void* id) const;
bool acquired_by_self() const;
void release();
void move(JfrBuffer* const to, size_t size);
@ -166,8 +167,6 @@ class JfrBuffer {
bool retired() const;
void set_retired();
void clear_retired();
debug_only(bool acquired_by_self() const;)
};
class JfrAgeNode : public JfrBuffer {

View File

@ -346,19 +346,19 @@ inline void process_free_list(Processor& processor, Mspace* mspace, jfr_iter_dir
template <typename Mspace>
inline bool ReleaseOp<Mspace>::process(typename Mspace::Type* t) {
assert(t != NULL, "invariant");
if (t->retired() || t->try_acquire(_thread)) {
if (t->transient()) {
if (_release_full) {
mspace_release_full_critical(t, _mspace);
} else {
mspace_release_free_critical(t, _mspace);
}
return true;
// assumes some means of exclusive access to t
if (t->transient()) {
if (_release_full) {
mspace_release_full_critical(t, _mspace);
} else {
mspace_release_free_critical(t, _mspace);
}
t->reinitialize();
assert(t->empty(), "invariant");
t->release(); // publish
return true;
}
t->reinitialize();
assert(t->empty(), "invariant");
assert(!t->retired(), "invariant");
t->release(); // publish
return true;
}

View File

@ -340,9 +340,9 @@ static bool full_buffer_registration(BufferPtr buffer, JfrStorageAgeMspace* age_
void JfrStorage::register_full(BufferPtr buffer, Thread* thread) {
assert(buffer != NULL, "invariant");
assert(buffer->retired(), "invariant");
assert(buffer->acquired_by(thread), "invariant");
if (!full_buffer_registration(buffer, _age_mspace, control(), thread)) {
handle_registration_failure(buffer);
buffer->release();
}
if (control().should_post_buffer_full_message()) {
_post_box.post(MSG_FULLBUFFER);
@ -377,8 +377,8 @@ void JfrStorage::release(BufferPtr buffer, Thread* thread) {
}
}
assert(buffer->empty(), "invariant");
assert(buffer->identity() != NULL, "invariant");
control().increment_dead();
buffer->release();
buffer->set_retired();
}
@ -733,13 +733,14 @@ public:
Scavenger(JfrStorageControl& control, Mspace* mspace) : _control(control), _mspace(mspace), _count(0), _amount(0) {}
bool process(Type* t) {
if (t->retired()) {
assert(t->identity() != NULL, "invariant");
assert(t->empty(), "invariant");
assert(!t->transient(), "invariant");
assert(!t->lease(), "invariant");
assert(t->empty(), "invariant");
assert(t->identity() == NULL, "invariant");
++_count;
_amount += t->total_size();
t->clear_retired();
t->release();
_control.decrement_dead();
mspace_release_full_critical(t, _mspace);
}

View File

@ -92,7 +92,6 @@ class ConcurrentWriteOpExcludeRetired : private ConcurrentWriteOp<Operation> {
size_t processed() const { return ConcurrentWriteOp<Operation>::processed(); }
};
template <typename Operation>
class MutexedWriteOp {
private:
@ -104,6 +103,15 @@ class MutexedWriteOp {
size_t processed() const { return _operation.processed(); }
};
template <typename Operation>
class ExclusiveOp : private MutexedWriteOp<Operation> {
public:
typedef typename Operation::Type Type;
ExclusiveOp(Operation& operation) : MutexedWriteOp<Operation>(operation) {}
bool process(Type* t);
size_t processed() const { return MutexedWriteOp<Operation>::processed(); }
};
enum jfr_operation_mode {
mutexed = 1,
concurrent

View File

@ -26,6 +26,7 @@
#define SHARE_VM_JFR_RECORDER_STORAGE_JFRSTORAGEUTILS_INLINE_HPP
#include "jfr/recorder/storage/jfrStorageUtils.hpp"
#include "runtime/thread.inline.hpp"
template <typename T>
inline bool UnBufferedWriteToChunk<T>::write(T* t, const u1* data, size_t size) {
@ -75,6 +76,28 @@ inline bool MutexedWriteOp<Operation>::process(typename Operation::Type* t) {
return result;
}
template <typename Type>
static void retired_sensitive_acquire(Type* t) {
assert(t != NULL, "invariant");
if (t->retired()) {
return;
}
Thread* const thread = Thread::current();
while (!t->try_acquire(thread)) {
if (t->retired()) {
return;
}
}
}
template <typename Operation>
inline bool ExclusiveOp<Operation>::process(typename Operation::Type* t) {
retired_sensitive_acquire(t);
assert(t->acquired_by_self() || t->retired(), "invariant");
// User is required to ensure proper release of the acquisition
return MutexedWriteOp<Operation>::process(t);
}
template <typename Operation>
inline bool DiscardOp<Operation>::process(typename Operation::Type* t) {
assert(t != NULL, "invariant");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, 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
@ -139,93 +139,76 @@ bool JfrStringPool::add(bool epoch, jlong id, jstring string, JavaThread* jt) {
return current_epoch;
}
class StringPoolWriteOp {
template <template <typename> class Operation>
class StringPoolOp {
public:
typedef JfrStringPoolBuffer Type;
private:
UnBufferedWriteToChunk<Type> _writer;
Operation<Type> _op;
Thread* _thread;
size_t _strings_processed;
public:
StringPoolWriteOp(JfrChunkWriter& writer, Thread* thread) : _writer(writer), _thread(thread), _strings_processed(0) {}
StringPoolOp() : _op(), _thread(Thread::current()), _strings_processed(0) {}
StringPoolOp(JfrChunkWriter& writer, Thread* thread) : _op(writer), _thread(thread), _strings_processed(0) {}
bool write(Type* buffer, const u1* data, size_t size) {
buffer->acquire(_thread); // blocking
assert(buffer->acquired_by(_thread) || buffer->retired(), "invariant");
const uint64_t nof_strings_used = buffer->string_count();
assert(nof_strings_used > 0, "invariant");
buffer->set_string_top(buffer->string_top() + nof_strings_used);
// "size processed" for string pool buffers is the number of processed string elements
_strings_processed += nof_strings_used;
const bool ret = _writer.write(buffer, data, size);
buffer->release();
return ret;
return _op.write(buffer, data, size);
}
size_t processed() { return _strings_processed; }
};
typedef StringPoolWriteOp WriteOperation;
typedef ConcurrentWriteOp<WriteOperation> ConcurrentWriteOperation;
template <typename Type>
class StringPoolDiscarderStub {
public:
bool write(Type* buffer, const u1* data, size_t size) {
// stub only, discard happens at higher level
return true;
}
};
typedef StringPoolOp<UnBufferedWriteToChunk> WriteOperation;
typedef StringPoolOp<StringPoolDiscarderStub> DiscardOperation;
typedef ExclusiveOp<WriteOperation> ExclusiveWriteOperation;
typedef ExclusiveOp<DiscardOperation> ExclusiveDiscardOperation;
typedef ReleaseOp<JfrStringPoolMspace> StringPoolReleaseOperation;
typedef CompositeOperation<ExclusiveWriteOperation, StringPoolReleaseOperation> StringPoolWriteOperation;
typedef CompositeOperation<ExclusiveDiscardOperation, StringPoolReleaseOperation> StringPoolDiscardOperation;
size_t JfrStringPool::write() {
Thread* const thread = Thread::current();
WriteOperation wo(_chunkwriter, thread);
ConcurrentWriteOperation cwo(wo);
assert(_free_list_mspace->is_full_empty(), "invariant");
process_free_list(cwo, _free_list_mspace);
return wo.processed();
}
typedef MutexedWriteOp<WriteOperation> MutexedWriteOperation;
typedef ReleaseOp<JfrStringPoolMspace> StringPoolReleaseOperation;
typedef CompositeOperation<MutexedWriteOperation, StringPoolReleaseOperation> StringPoolWriteOperation;
size_t JfrStringPool::write_at_safepoint() {
assert(SafepointSynchronize::is_at_safepoint(), "invariant");
Thread* const thread = Thread::current();
WriteOperation wo(_chunkwriter, thread);
MutexedWriteOperation mwo(wo);
ExclusiveWriteOperation ewo(wo);
StringPoolReleaseOperation spro(_free_list_mspace, thread, false);
StringPoolWriteOperation spwo(&mwo, &spro);
StringPoolWriteOperation spwo(&ewo, &spro);
assert(_free_list_mspace->is_full_empty(), "invariant");
process_free_list(spwo, _free_list_mspace);
return wo.processed();
}
class StringPoolBufferDiscarder {
private:
Thread* _thread;
size_t _processed;
public:
typedef JfrStringPoolBuffer Type;
StringPoolBufferDiscarder() : _thread(Thread::current()), _processed(0) {}
bool process(Type* buffer) {
buffer->acquire(_thread); // serialized access
const u1* const current_top = buffer->top();
const size_t unflushed_size = buffer->pos() - current_top;
if (unflushed_size == 0) {
assert(buffer->string_count() == 0, "invariant");
buffer->release();
return true;
}
buffer->set_top(current_top + unflushed_size);
const uint64_t nof_strings_used = buffer->string_count();
buffer->set_string_top(buffer->string_top() + nof_strings_used);
// "size processed" for string pool buffers is the number of string elements
_processed += (size_t)nof_strings_used;
buffer->release();
return true;
}
size_t processed() const { return _processed; }
};
size_t JfrStringPool::write_at_safepoint() {
assert(SafepointSynchronize::is_at_safepoint(), "invariant");
return write();
}
size_t JfrStringPool::clear() {
StringPoolBufferDiscarder discard_operation;
DiscardOperation discard_operation;
ExclusiveDiscardOperation edo(discard_operation);
StringPoolReleaseOperation spro(_free_list_mspace, Thread::current(), false);
StringPoolDiscardOperation spdo(&edo, &spro);
assert(_free_list_mspace->is_full_empty(), "invariant");
process_free_list(discard_operation, _free_list_mspace);
process_free_list(spdo, _free_list_mspace);
return discard_operation.processed();
}
void JfrStringPool::register_full(BufferPtr t, Thread* thread) {
// nothing here at the moment
assert(t != NULL, "invariant");
assert(t->acquired_by(thread), "invariant");
assert(t->retired(), "invariant");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2019, 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
@ -29,11 +29,9 @@ JfrStringPoolBuffer::JfrStringPoolBuffer() : JfrBuffer(), _string_count_pos(0),
void JfrStringPoolBuffer::reinitialize() {
assert(acquired_by_self() || retired(), "invariant");
concurrent_top();
set_pos((start()));
set_string_pos(0);
set_string_top(0);
set_concurrent_top(start());
JfrBuffer::reinitialize();
}
uint64_t JfrStringPoolBuffer::string_pos() const {
@ -57,7 +55,7 @@ void JfrStringPoolBuffer::set_string_pos(uint64_t value) {
}
void JfrStringPoolBuffer::increment(uint64_t value) {
assert(acquired_by_self() || retired(), "invariant");
assert(acquired_by_self(), "invariant");
++_string_count_pos;
}

View File

@ -1043,3 +1043,6 @@ a3dcb5ebdf433b340419faf6698443a613415a79 jdk8u262-b01
d054aabd2e3c09de0ff622b4fab09388d30aee02 jdk8u262-b04
976e73cfac410997160b1d3d6e14a88a324440c3 jdk8u262-b05
ddbd856338439f2d5f742040d896e27f0f104cd1 jdk8u262-b06
ebb0a284b7e75dfb741af3332eb87b37aca66875 jdk8u262-b07
0cccb32a50471fd52ecf2f697d95e7254798ab26 jdk8u262-b08
779db06fb02444e294b7c93fe3902afee615df2a jdk8u262-b09

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
*/
/*
@ -71,6 +71,7 @@ import java.io.IOException;
* @author Eric Ye, IBM
*
* @version $Id: XMLDTDScannerImpl.java,v 1.8 2010-11-01 04:39:41 joehw Exp $
* @LastModified: Feb 2020
*/
public class XMLDTDScannerImpl
extends XMLScanner
@ -615,6 +616,7 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler {
if (fScannerState == SCANNER_STATE_END_OF_INPUT)
return;
boolean dtdEntity = name.equals("[dtd]");
// Handle end of PE
boolean reportEntity = fReportEntity;
if (name.startsWith("%")) {
@ -623,8 +625,7 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler {
int startMarkUpDepth = popPEStack();
// throw fatalError if this entity was incomplete and
// was a freestanding decl
if(startMarkUpDepth == 0 &&
startMarkUpDepth < fMarkUpDepth) {
if (startMarkUpDepth == 0 && startMarkUpDepth < fMarkUpDepth) {
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"ILL_FORMED_PARAMETER_ENTITY_WHEN_USED_IN_DECL",
new Object[]{ fEntityManager.fCurrentEntity.name},
@ -644,12 +645,10 @@ implements XMLDTDScanner, XMLComponent, XMLEntityHandler {
if (fEntityScanner.isExternal()) {
fExtEntityDepth--;
}
}
// call handler
boolean dtdEntity = name.equals("[dtd]");
if (fDTDHandler != null && !dtdEntity && reportEntity) {
fDTDHandler.endParameterEntity(name, null);
// call handler
if (fDTDHandler != null && reportEntity) {
fDTDHandler.endParameterEntity(name, null);
}
}
// end DTD

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
*/
/*
@ -69,6 +69,7 @@ import com.sun.xml.internal.stream.Entity;
* @author K.Venugopal SUN Microsystems
* @author Sunitha Reddy, SUN Microsystems
* @version $Id: XMLScanner.java,v 1.12 2010-11-01 04:39:41 joehw Exp $
* @LastModified: Feb 2020
*/
public abstract class XMLScanner
implements XMLComponent {
@ -1240,10 +1241,10 @@ public abstract class XMLScanner
* @throws XNIException Thrown by handler to signal an error.
*/
public void endEntity(String name, Augmentations augs) throws IOException, XNIException {
// keep track of the entity depth
fEntityDepth--;
if (fEntityDepth > 0) {
fEntityDepth--;
}
} // endEntity(String)
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -61,6 +61,7 @@ import java.util.Map;
* @author Neil Graham, IBM
*
* @version $Id: DTDGrammar.java,v 1.4 2010/08/11 07:18:37 joehw Exp $
* @LastModified: Feb 2020
*/
public class DTDGrammar
implements XMLDTDHandler, XMLDTDContentModelHandler, EntityState, Grammar {
@ -445,9 +446,12 @@ public class DTDGrammar
* @throws XNIException Thrown by handler to signal an error.
*/
public void endParameterEntity(String name, Augmentations augs) throws XNIException {
fPEDepth--;
fReadingExternalDTD = fPEntityStack[fPEDepth];
// redundant check as this method can only be called after parsing a PE
// incomplete or truncated DTD get caught before reaching this method
if (fPEDepth > 0) {
fPEDepth--;
fReadingExternalDTD = fPEntityStack[fPEDepth];
}
} // endParameterEntity(String,Augmentations)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -106,6 +106,7 @@ import jdk.xml.internal.JdkXmlUtils;
* @author Andy Clark IBM
* @author Neeraj Bajaj, Sun Microsystems, inc.
* @version $Id: XMLSchemaValidator.java,v 1.16 2010-11-01 04:39:55 joehw Exp $
* @LastModified: Apr 2020
*/
public class XMLSchemaValidator
implements XMLComponent, XMLDocumentFilter, FieldActivator, RevalidationHandler {
@ -1727,7 +1728,7 @@ public class XMLSchemaValidator
// root element
if (fElementDepth == -1 && fValidationManager.isGrammarFound()) {
if (fSchemaType == null) {
if (fSchemaType == null && !fUseGrammarPoolOnly) {
// schemaType is not specified
// if a DTD grammar is found, we do the same thing as Dynamic:
// if a schema grammar is found, validation is performed;

View File

@ -1037,3 +1037,6 @@ a708c11c582dce75a6b134e4dfb6f3f3aa05ef8d jdk8u262-b03
caa13cd34f715d6db597adca78732b94f3728bae jdk8u262-b04
96946cef7eade1693fe6dbd2e6001f36defb0295 jdk8u262-b05
0e54ba3037a2a8d5c93d8909aeaa75f9e55bf82a jdk8u262-b06
494c863af128b32c7462e49c32ce3a422033e4d2 jdk8u262-b07
cb41a9e2bafd0e332c5906dde9840816dc279b9c jdk8u262-b08
cd7ed8c648058a8fa01242d73e9754f455559c3e jdk8u262-b09

View File

@ -1038,3 +1038,6 @@ f332bb3e282f082f2d386ea860fc5c4b4652f2bd jdk8u262-b01
63cecc0bd71d5226d7bdf81aeaa2e662dbad54c9 jdk8u262-b04
4789a6a01301851b530fddbf7b0ce28f717f3de7 jdk8u262-b05
097f47e7fe97b47dcb02603d9d592e1cba7f564e jdk8u262-b06
745caf348aeec7b19f9f92ad283e3f8bd498dd02 jdk8u262-b07
235d2e871a2ec6ddc97956caddd69f589a390649 jdk8u262-b08
e36dcb7d407e9d4d739e03ce1dd2b641bd59ec30 jdk8u262-b09

View File

@ -302,9 +302,11 @@ $(eval $(call SetupLauncher,jdb, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.example.debug.tty.TTY"$(COMMA) }' \
-DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))
ifeq ($(ENABLE_JFR), true)
$(eval $(call SetupLauncher,jfr, \
-DEXPAND_CLASSPATH_WILDCARDS \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.jfr.internal.tool.Main"$(COMMA) }'))
endif
$(eval $(call SetupLauncher,jhat, \
-DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.hat.Main"$(COMMA) }'))

View File

@ -1,31 +0,0 @@
Owner: CN=AddTrust Class 1 CA Root, OU=AddTrust TTP Network, O=AddTrust AB, C=SE
Issuer: CN=AddTrust Class 1 CA Root, OU=AddTrust TTP Network, O=AddTrust AB, C=SE
Serial number: 1
Valid from: Tue May 30 10:38:31 GMT 2000 until: Sat May 30 10:38:31 GMT 2020
Signature algorithm name: SHA1withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3
-----BEGIN CERTIFICATE-----
MIIEGDCCAwCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQGEwJTRTEU
MBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3
b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwHhcNMDAwNTMw
MTAzODMxWhcNMjAwNTMwMTAzODMxWjBlMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
QWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFkZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYD
VQQDExhBZGRUcnVzdCBDbGFzcyAxIENBIFJvb3QwggEiMA0GCSqGSIb3DQEBAQUA
A4IBDwAwggEKAoIBAQCWltQhSWDia+hBBwzexODcEyPNwTXH+9ZOEQpnXvUGW2ul
CDtbKRY654eyNAbFvAWlA3yCyykQruGIgb3WntP+LVbBFc7jJp0VLhD7Bo8wBN6n
tGO0/7Gcrjyvd7ZWxbWroulpOj0OM3kyP3CCkplhbY0wCI9xP6ZIVxn4JdxLZlyl
dI+Yrsj5wAYi56xz36Uu+1LcsRVlIPo1Zmne3yzxbrww2ywkEtvrNTVokMsAsJch
PXQhI2U0K7t4WaPW4XY5mqRJjox0r26kmqPZm9I4XJuiGMx1I4S+6+JNM3GOGvDC
+Mcdoq0Dlyz4zyXG9rgkMbFjXZJ/Y/AlyVMuH79NAgMBAAGjgdIwgc8wHQYDVR0O
BBYEFJWxtPCUtr3H2tERCSG+wa9J/RB7MAsGA1UdDwQEAwIBBjAPBgNVHRMBAf8E
BTADAQH/MIGPBgNVHSMEgYcwgYSAFJWxtPCUtr3H2tERCSG+wa9J/RB7oWmkZzBl
MQswCQYDVQQGEwJTRTEUMBIGA1UEChMLQWRkVHJ1c3QgQUIxHTAbBgNVBAsTFEFk
ZFRydXN0IFRUUCBOZXR3b3JrMSEwHwYDVQQDExhBZGRUcnVzdCBDbGFzcyAxIENB
IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBACxtZBsfzQ3duQH6lmM0MkhHma6X
7f1yFqZzR1r0693p9db7RcwpiURdv0Y5PejuvE1Uhh4dbOMXJ0PhiVYrqW9yTkkz
43J8KiOavD7/KCrto/8cI7pDVwlnTUtiBi34/2ydYB7YHEt9tTEv2dB8Xfjea4MY
eDdXL+gzB2ffHsdrKpV2ro9Xo/D0UrSpUwjP4E/TelOL/bscVjby/rK25Xa71SJl
pz/+0WatC7xrmYbvP33zGDLKe8bjq2RGlfgmadlVg3sslgf/WSxEo8bl6ancoWOA
WiFeIc9TVPC6b4nbqKqVz4vjccweGyBECMB6tkD9xOQ14R0WHNC8K47Wcdk=
-----END CERTIFICATE-----

View File

@ -1,30 +0,0 @@
Owner: CN=KEYNECTIS ROOT CA, OU=ROOT, O=KEYNECTIS, C=FR
Issuer: CN=KEYNECTIS ROOT CA, OU=ROOT, O=KEYNECTIS, C=FR
Serial number: 1121bc276c5547af584eefd4ced629b2a285
Valid from: Tue May 26 00:00:00 GMT 2009 until: Tue May 26 00:00:00 GMT 2020
Signature algorithm name: SHA256withRSA
Subject Public Key Algorithm: 2048-bit RSA key
Version: 3
-----BEGIN CERTIFICATE-----
MIID5TCCAs2gAwIBAgISESG8J2xVR69YTu/UztYpsqKFMA0GCSqGSIb3DQEBCwUA
MEwxCzAJBgNVBAYTAkZSMRIwEAYDVQQKEwlLRVlORUNUSVMxDTALBgNVBAsTBFJP
T1QxGjAYBgNVBAMTEUtFWU5FQ1RJUyBST09UIENBMB4XDTA5MDUyNjAwMDAwMFoX
DTIwMDUyNjAwMDAwMFowTDELMAkGA1UEBhMCRlIxEjAQBgNVBAoTCUtFWU5FQ1RJ
UzENMAsGA1UECxMEUk9PVDEaMBgGA1UEAxMRS0VZTkVDVElTIFJPT1QgQ0EwggEi
MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDG/bMXhaGtJhuVaTUhPaSI+t7b
YDZAF2nCFGP7uNnCdBU3LpzQIM1pjYQyooVMFLSb8iWzVCqDPy2+D/M7ZNH/oFDv
d087TuE/C2SFmrpYftLDYtNkJaLUspc8d11jKjOS/M2CDZtUlYf1teuMzVvRyjAv
yYhGtc0NEbQYj+7RoT5dFegoz9/DkJtszNEMRXezOuuKkB3pr2RqiXupPUN0+uRn
IqH73E3E9WLJyiW0yYBgM6nde6ACv5YlCl7JXyl7tBeBi22BGdDZg1wFj0FpGmlD
gJ+or+DpjJGLJyuiJmDND/KkowKDjhiBwheKQxX5bfMdEKRanERhIyF62PvRAgMB
AAGjgcAwgb0wEgYDVR0TAQH/BAgwBgEB/wIBBDAOBgNVHQ8BAf8EBAMCAQYwVwYD
VR0fBFAwTjBMoEqgSIZGaHR0cDovL3RydXN0Y2VudGVyLWNybC5jZXJ0aWZpY2F0
Mi5jb20vS2V5bmVjdGlzL0tFWU5FQ1RJU19ST09UX0NBLmNybDAdBgNVHQ4EFgQU
77cjl9CokX+mz6YhwDSfzHdB4dAwHwYDVR0jBBgwFoAU77cjl9CokX+mz6YhwDSf
zHdB4dAwDQYJKoZIhvcNAQELBQADggEBABoxaZlCwuVAhaKfksNj1I8hOagZIf56
/MNNQPMr6EusW0xZk8bcfguvfF+VhWu9x2+6wb74xjpnS5PGBWk+JC3wG5HGPj/s
QhiTbAMkim75IGcrfG2rNMkqIjMN132P7tI2ZELINZpuGWHLjWfwaKfQJAXmwxe6
Ra58Q7WAeANNIHMF/EMQnTVpQnWUJYIrpjuQGN7Bqa/zLZW/lafPGJfhWeKirxoW
YQ33E3FTkzf9PK8AHWyLFK9Gloy2UnzMLU7N4elLCu6a/nqY5ym6G9ocutxrzQQO
JkCp63M8/lCoESdVvduOS+9PGO0V/72GmGbumiVxNGxQ8bJRy2adTSk=
-----END CERTIFICATE-----

View File

@ -658,6 +658,13 @@ endif
##########################################################################################
ifeq ($(TOOLCHAIN_TYPE), clang)
ifeq ($(TOOLCHAIN_VERSION), 10.1)
# Work around an optimizer bug seen with Xcode 10.1, but fixed by 10.3
BUILD_LIBLCMS_cmsopt.c_CFLAGS := -O0
endif
endif
# TODO: Update awt lib path when awt is converted
$(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
LIBRARY := lcms, \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2020, 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
@ -226,6 +226,9 @@ public final class KeychainStore extends KeyStoreSpi {
// Get the Algorithm ID next
DerValue[] value = in.getSequence(2);
if (value.length < 1 || value.length > 2) {
throw new IOException("Invalid length for AlgorithmIdentifier");
}
AlgorithmId algId = new AlgorithmId(value[0].getOID());
String algName = algId.getName();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, 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
@ -202,10 +202,14 @@ public:
// (required only if Write() can override the buffer)
bool Allocate(int requestedBufferSize, int extraBytes) {
int fullBufferSize = requestedBufferSize + extraBytes;
int powerOfTwo = 1;
long powerOfTwo = 1;
while (powerOfTwo < fullBufferSize) {
powerOfTwo <<= 1;
}
if (powerOfTwo > INT_MAX || fullBufferSize < 0) {
ERROR0("RingBuffer::Allocate: REQUESTED MEMORY SIZE IS TOO BIG\n");
return false;
}
pBuffer = (Byte*)malloc(powerOfTwo);
if (pBuffer == NULL) {
ERROR0("RingBuffer::Allocate: OUT OF MEMORY\n");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, 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
@ -922,8 +922,6 @@ public final class JceKeyStore extends KeyStoreSpi {
*/
private static class DeserializationChecker implements ObjectInputFilter {
private static final int MAX_NESTED_DEPTH = 2;
// Full length of keystore, anything inside a SecretKeyEntry should not
// be bigger. Otherwise, must be illegal.
private final int fullLength;
@ -936,16 +934,29 @@ public final class JceKeyStore extends KeyStoreSpi {
public ObjectInputFilter.Status
checkInput(ObjectInputFilter.FilterInfo info) {
// First run a custom filter
long nestedDepth = info.depth();
if ((nestedDepth == 1 &&
info.serialClass() != SealedObjectForKeyProtector.class) ||
info.arrayLength() > fullLength ||
(nestedDepth > MAX_NESTED_DEPTH &&
info.serialClass() != null &&
info.serialClass() != Object.class)) {
if (info.arrayLength() > fullLength) {
return Status.REJECTED;
}
// First run a custom filter
Class<?> clazz = info.serialClass();
switch((int)info.depth()) {
case 1:
if (clazz != SealedObjectForKeyProtector.class) {
return Status.REJECTED;
}
break;
case 2:
if (clazz != null && clazz != SealedObject.class
&& clazz != byte[].class) {
return Status.REJECTED;
}
break;
default:
if (clazz != null && clazz != Object.class) {
return Status.REJECTED;
}
break;
}
// Next run the default filter, if available
ObjectInputFilter defaultFilter =

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, 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
@ -1121,7 +1121,7 @@ final class DirectAudioDevice extends AbstractMixer {
public void open(AudioInputStream stream) throws LineUnavailableException, IOException {
// $$fb part of fix for 4679187: Clip.open() throws unexpected Exceptions
Toolkit.isFullySpecifiedAudioFormat(format);
Toolkit.isFullySpecifiedAudioFormat(stream.getFormat());
synchronized (mixer) {
if (Printer.trace) Printer.trace("> DirectClip.open(stream)");
@ -1135,11 +1135,18 @@ final class DirectAudioDevice extends AbstractMixer {
if (Printer.debug) Printer.debug("DirectClip: open(AIS): lengthInFrames: " + lengthInFrames);
int bytesRead = 0;
int frameSize = stream.getFormat().getFrameSize();
if (lengthInFrames != AudioSystem.NOT_SPECIFIED) {
// read the data from the stream into an array in one fell swoop.
int arraysize = lengthInFrames * stream.getFormat().getFrameSize();
streamData = new byte[arraysize];
int arraysize = lengthInFrames * frameSize;
if (arraysize < 0) {
throw new IllegalArgumentException("Audio data < 0");
}
try {
streamData = new byte[arraysize];
} catch (OutOfMemoryError e) {
throw new IOException("Audio data is too big");
}
int bytesRemaining = arraysize;
int thisRead = 0;
while (bytesRemaining > 0 && thisRead >= 0) {
@ -1157,9 +1164,14 @@ final class DirectAudioDevice extends AbstractMixer {
// we use a slightly modified version of ByteArrayOutputStream
// to get direct access to the byte array (we don't want a new array
// to be allocated)
int MAX_READ_LIMIT = 16384;
int maxReadLimit = Math.max(16384, frameSize);
DirectBAOS dbaos = new DirectBAOS();
byte tmp[] = new byte[MAX_READ_LIMIT];
byte[] tmp;
try {
tmp = new byte[maxReadLimit];
} catch (OutOfMemoryError e) {
throw new IOException("Audio data is too big");
}
int thisRead = 0;
while (thisRead >= 0) {
thisRead = stream.read(tmp, 0, tmp.length);
@ -1173,7 +1185,7 @@ final class DirectAudioDevice extends AbstractMixer {
} // while
streamData = dbaos.getInternalBuffer();
}
lengthInFrames = bytesRead / stream.getFormat().getFrameSize();
lengthInFrames = bytesRead / frameSize;
if (Printer.debug) Printer.debug("Read to end of stream. lengthInFrames: " + lengthInFrames);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@ -154,6 +154,14 @@ public final class Toolkit {
}
static void isFullySpecifiedAudioFormat(AudioFormat format) {
// Our code requires a positive frame size, that's probably is not
// necessary for non-linear encodings, but for now
// IllegalArgumentException is better than ArithmeticException
if (format.getFrameSize() <= 0) {
throw new IllegalArgumentException("invalid frame size: "
+((format.getFrameSize() == -1) ?
"NOT_SPECIFIED":String.valueOf(format.getFrameSize())));
}
if (!format.getEncoding().equals(AudioFormat.Encoding.PCM_SIGNED)
&& !format.getEncoding().equals(AudioFormat.Encoding.PCM_UNSIGNED)
&& !format.getEncoding().equals(AudioFormat.Encoding.ULAW)
@ -176,11 +184,6 @@ public final class Toolkit {
+((format.getSampleSizeInBits()==-1)?
"NOT_SPECIFIED":String.valueOf(format.getSampleSizeInBits())));
}
if (format.getFrameSize() <= 0) {
throw new IllegalArgumentException("invalid frame size: "
+((format.getFrameSize()==-1)?
"NOT_SPECIFIED":String.valueOf(format.getFrameSize())));
}
if (format.getChannels() <= 0) {
throw new IllegalArgumentException("invalid number of channels: "
+((format.getChannels()==-1)?

View File

@ -50,6 +50,7 @@ import sun.misc.SharedSecrets;
import sun.reflect.misc.ReflectUtil;
import sun.misc.JavaOISAccess;
import sun.util.logging.PlatformLogger;
import sun.security.action.GetBooleanAction;
/**
* An ObjectInputStream deserializes primitive data and objects previously
@ -243,6 +244,23 @@ public class ObjectInputStream
/** queue for WeakReferences to audited subclasses */
static final ReferenceQueue<Class<?>> subclassAuditsQueue =
new ReferenceQueue<>();
/**
* Property to permit setting a filter after objects
* have been read.
* See {@link #setObjectInputFilter(ObjectInputFilter)}
*/
static final boolean SET_FILTER_AFTER_READ =
privilegedGetProperty("jdk.serialSetFilterAfterRead");
private static boolean privilegedGetProperty(String theProp) {
if (System.getSecurityManager() == null) {
return Boolean.getBoolean(theProp);
} else {
return AccessController.doPrivileged(
new GetBooleanAction(theProp));
}
}
}
static {
@ -1250,6 +1268,10 @@ public class ObjectInputStream
serialFilter != ObjectInputFilter.Config.getSerialFilter()) {
throw new IllegalStateException("filter can not be set more than once");
}
if (totalObjectRefs > 0 && !Caches.SET_FILTER_AFTER_READ) {
throw new IllegalStateException(
"filter can not be set after an object has been read");
}
this.serialFilter = filter;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, 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
@ -274,8 +274,8 @@ public abstract class Buffer {
if ((newLimit > capacity) || (newLimit < 0))
throw new IllegalArgumentException();
limit = newLimit;
if (position > limit) position = limit;
if (mark > limit) mark = -1;
if (position > newLimit) position = newLimit;
if (mark > newLimit) mark = -1;
return this;
}
@ -496,16 +496,18 @@ public abstract class Buffer {
* @return The current position value, before it is incremented
*/
final int nextGetIndex() { // package-private
if (position >= limit)
int p = position;
if (p >= limit)
throw new BufferUnderflowException();
return position++;
position = p + 1;
return p;
}
final int nextGetIndex(int nb) { // package-private
if (limit - position < nb)
throw new BufferUnderflowException();
int p = position;
position += nb;
if (limit - p < nb)
throw new BufferUnderflowException();
position = p + nb;
return p;
}
@ -517,16 +519,18 @@ public abstract class Buffer {
* @return The current position value, before it is incremented
*/
final int nextPutIndex() { // package-private
if (position >= limit)
int p = position;
if (p >= limit)
throw new BufferOverflowException();
return position++;
position = p + 1;
return p;
}
final int nextPutIndex(int nb) { // package-private
if (limit - position < nb)
throw new BufferOverflowException();
int p = position;
position += nb;
if (limit - p < nb)
throw new BufferOverflowException();
position = p + nb;
return p;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2020, 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
@ -433,6 +433,12 @@ public abstract class MessageDigest extends MessageDigestSpi {
/**
* Compares two digests for equality. Does a simple byte compare.
*
* @implNote
* All bytes in {@code digesta} are examined to determine equality.
* The calculation time depends only on the length of {@code digesta}.
* It does not depend on the length of {@code digestb} or the contents
* of {@code digesta} and {@code digestb}.
*
* @param digesta one of the digests to compare.
*
* @param digestb the other digest to compare.
@ -444,14 +450,22 @@ public abstract class MessageDigest extends MessageDigestSpi {
if (digesta == null || digestb == null) {
return false;
}
if (digesta.length != digestb.length) {
return false;
int lenA = digesta.length;
int lenB = digestb.length;
if (lenB == 0) {
return lenA == 0;
}
int result = 0;
result |= lenA - lenB;
// time-constant comparison
for (int i = 0; i < digesta.length; i++) {
result |= digesta[i] ^ digestb[i];
for (int i = 0; i < lenA; i++) {
// If i >= lenB, indexB is 0; otherwise, i.
int indexB = ((i - lenB) >>> 31) * i;
result |= digesta[i] ^ digestb[indexB];
}
return result == 0;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, 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
@ -252,6 +252,9 @@ public final class PKCS12Attribute implements KeyStore.Entry.Attribute {
private void parse(byte[] encoded) throws IOException {
DerInputStream attributeValue = new DerInputStream(encoded);
DerValue[] attrSeq = attributeValue.getSequence(2);
if (attrSeq.length != 2) {
throw new IOException("Invalid length for PKCS12Attribute");
}
ObjectIdentifier type = attrSeq[0].getOID();
DerInputStream attrContent =
new DerInputStream(attrSeq[1].toByteArray());

View File

@ -175,14 +175,16 @@ public class ArrayList<E> extends AbstractList<E>
* @throws NullPointerException if the specified collection is null
*/
public ArrayList(Collection<? extends E> c) {
elementData = c.toArray();
if ((size = elementData.length) != 0) {
// c.toArray might (incorrectly) not return Object[] (see 6260652)
if (elementData.getClass() != Object[].class)
elementData = Arrays.copyOf(elementData, size, Object[].class);
Object[] a = c.toArray();
if ((size = a.length) != 0) {
if (c.getClass() == ArrayList.class) {
elementData = a;
} else {
elementData = Arrays.copyOf(a, size, Object[].class);
}
} else {
// replace with empty array.
this.elementData = EMPTY_ELEMENTDATA;
elementData = EMPTY_ELEMENTDATA;
}
}

View File

@ -254,8 +254,7 @@ public class PriorityQueue<E> extends AbstractQueue<E>
private void initElementsFromCollection(Collection<? extends E> c) {
Object[] a = c.toArray();
// If c.toArray incorrectly doesn't return Object[], copy it.
if (a.getClass() != Object[].class)
if (c.getClass() != ArrayList.class)
a = Arrays.copyOf(a, a.length, Object[].class);
int len = a.length;
if (len == 1 || this.comparator != null)

View File

@ -171,11 +171,13 @@ public class Vector<E>
* @since 1.2
*/
public Vector(Collection<? extends E> c) {
elementData = c.toArray();
elementCount = elementData.length;
// c.toArray might (incorrectly) not return Object[] (see 6260652)
if (elementData.getClass() != Object[].class)
elementData = Arrays.copyOf(elementData, elementCount, Object[].class);
Object[] a = c.toArray();
elementCount = a.length;
if (c.getClass() == ArrayList.class) {
elementData = a;
} else {
elementData = Arrays.copyOf(a, elementCount, Object[].class);
}
}
/**

View File

@ -34,6 +34,7 @@
package java.util.concurrent;
import java.util.AbstractList;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
@ -135,8 +136,7 @@ public class CopyOnWriteArrayList<E>
elements = ((CopyOnWriteArrayList<?>)c).getArray();
else {
elements = c.toArray();
// c.toArray might (incorrectly) not return Object[] (see 6260652)
if (elements.getClass() != Object[].class)
if (c.getClass() != java.util.ArrayList.class)
elements = Arrays.copyOf(elements, elements.length, Object[].class);
}
setArray(elements);
@ -762,6 +762,9 @@ public class CopyOnWriteArrayList<E>
*/
public int addAllAbsent(Collection<? extends E> c) {
Object[] cs = c.toArray();
if (c.getClass() != ArrayList.class) {
cs = cs.clone();
}
if (cs.length == 0)
return 0;
final ReentrantLock lock = this.lock;
@ -822,9 +825,10 @@ public class CopyOnWriteArrayList<E>
try {
Object[] elements = getArray();
int len = elements.length;
if (len == 0 && cs.getClass() == Object[].class)
if (len == 0 && (c.getClass() == CopyOnWriteArrayList.class ||
c.getClass() == ArrayList.class)) {
setArray(cs);
else {
} else {
Object[] newElements = Arrays.copyOf(elements, len + cs.length);
System.arraycopy(cs, 0, newElements, len, cs.length);
setArray(newElements);

View File

@ -73,6 +73,11 @@ public class ForkJoinWorkerThread extends Thread {
final ForkJoinPool pool; // the pool this thread works in
final ForkJoinPool.WorkQueue workQueue; // work-stealing mechanics
/** An AccessControlContext supporting no privileges */
private static final AccessControlContext INNOCUOUS_ACC =
new AccessControlContext(
new ProtectionDomain[] { new ProtectionDomain(null, null) });
/**
* Creates a ForkJoinWorkerThread operating in the given pool.
*
@ -82,6 +87,7 @@ public class ForkJoinWorkerThread extends Thread {
protected ForkJoinWorkerThread(ForkJoinPool pool) {
// Use a placeholder until a useful name can be set in registerWorker
super("aForkJoinWorkerThread");
U.putOrderedObject(this, INHERITEDACCESSCONTROLCONTEXT, INNOCUOUS_ACC);
this.pool = pool;
this.workQueue = pool.registerWorker(this);
}
@ -215,13 +221,6 @@ public class ForkJoinWorkerThread extends Thread {
private static final ThreadGroup innocuousThreadGroup =
createThreadGroup();
/** An AccessControlContext supporting no privileges */
private static final AccessControlContext INNOCUOUS_ACC =
new AccessControlContext(
new ProtectionDomain[] {
new ProtectionDomain(null, null)
});
InnocuousForkJoinWorkerThread(ForkJoinPool pool) {
super(pool, innocuousThreadGroup, INNOCUOUS_ACC);
}

View File

@ -263,8 +263,7 @@ public class PriorityBlockingQueue<E> extends AbstractQueue<E>
}
Object[] a = c.toArray();
int n = a.length;
// If c.toArray incorrectly doesn't return Object[], copy it.
if (a.getClass() != Object[].class)
if (c.getClass() != java.util.ArrayList.class)
a = Arrays.copyOf(a, n, Object[].class);
if (screen && (n == 1 || this.comparator != null)) {
for (int i = 0; i < n; ++i)

View File

@ -570,8 +570,8 @@ public class TrueTypeFont extends FileFont {
tableDirectory[i] = table = new DirectoryEntry();
table.tag = ibuffer.get();
/* checksum */ ibuffer.get();
table.offset = ibuffer.get();
table.length = ibuffer.get();
table.offset = ibuffer.get() & 0x7FFFFFFF;
table.length = ibuffer.get() & 0x7FFFFFFF;
if (table.offset + table.length > fileSize) {
throw new FontFormatException("bad table, tag="+table.tag);
}

View File

@ -185,7 +185,7 @@ public final class Punycode {
for(j=0; j<srcLength; ++j) {
if(srcCPCount==MAX_CP_COUNT) {
/* too many input code points */
throw new IndexOutOfBoundsException();
throw new ParseException("Too many input code points", -1);
}
c=src.charAt(j);
if(isBasic(c)) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2020, 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
@ -130,6 +130,9 @@ public class ContentInfo {
DerValue[] contents;
typeAndContent = derin.getSequence(2);
if (typeAndContent.length < 1 || typeAndContent.length > 2) {
throw new ParsingException("Invalid length for ContentInfo");
}
// Parse the content type
type = typeAndContent[0];
@ -149,6 +152,9 @@ public class ContentInfo {
disTaggedContent
= new DerInputStream(taggedContent.toByteArray());
contents = disTaggedContent.getSet(1, true);
if (contents.length != 1) {
throw new ParsingException("ContentInfo encoding error");
}
content = contents[0];
}
}

View File

@ -144,6 +144,9 @@ public class SignerInfo implements DerEncoder {
// issuerAndSerialNumber
DerValue[] issuerAndSerialNumber = derin.getSequence(2);
if (issuerAndSerialNumber.length != 2) {
throw new ParsingException("Invalid length for IssuerAndSerialNumber");
}
byte[] issuerBytes = issuerAndSerialNumber[0].toByteArray();
issuerName = new X500Name(new DerValue(DerValue.tag_Sequence,
issuerBytes));

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@ -59,10 +59,16 @@ class MacData {
throws IOException, ParsingException
{
DerValue[] macData = derin.getSequence(2);
if (macData.length < 2 || macData.length > 3) {
throw new ParsingException("Invalid length for MacData");
}
// Parse the digest info
DerInputStream digestIn = new DerInputStream(macData[0].toByteArray());
DerValue[] digestInfo = digestIn.getSequence(2);
if (digestInfo.length != 2) {
throw new ParsingException("Invalid length for DigestInfo");
}
// Parse the DigestAlgorithmIdentifier.
AlgorithmId digestAlgorithmId = AlgorithmId.parse(digestInfo[0]);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@ -389,6 +389,9 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
DerInputStream in = val.toDerInputStream();
int i = in.getInteger();
DerValue[] value = in.getSequence(2);
if (value.length < 1 || value.length > 2) {
throw new IOException("Invalid length for AlgorithmIdentifier");
}
AlgorithmId algId = new AlgorithmId(value[0].getOID());
String keyAlgo = algId.getName();
@ -2000,11 +2003,17 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
DerInputStream edi =
safeContents.getContent().toDerInputStream();
int edVersion = edi.getInteger();
DerValue[] seq = edi.getSequence(2);
DerValue[] seq = edi.getSequence(3);
if (seq.length != 3) {
// We require the encryptedContent field, even though
// it is optional
throw new IOException("Invalid length for EncryptedContentInfo");
}
ObjectIdentifier edContentType = seq[0].getOID();
eAlgId = seq[1].toByteArray();
if (!seq[2].isContextSpecific((byte)0)) {
throw new IOException("encrypted content not present!");
throw new IOException("unsupported encrypted content type "
+ seq[2].tag);
}
byte newTag = DerValue.tag_OctetString;
if (seq[2].isConstructed())
@ -2218,6 +2227,9 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
} else if (bagId.equals((Object)CertBag_OID)) {
DerInputStream cs = new DerInputStream(bagValue.toByteArray());
DerValue[] certValues = cs.getSequence(2);
if (certValues.length != 2) {
throw new IOException("Invalid length for CertBag");
}
ObjectIdentifier certId = certValues[0].getOID();
if (!certValues[1].isContextSpecific((byte)0)) {
throw new IOException("unsupported PKCS12 cert value type "
@ -2233,6 +2245,9 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
} else if (bagId.equals((Object)SecretBag_OID)) {
DerInputStream ss = new DerInputStream(bagValue.toByteArray());
DerValue[] secretValues = ss.getSequence(2);
if (secretValues.length != 2) {
throw new IOException("Invalid length for SecretBag");
}
ObjectIdentifier secretId = secretValues[0].getOID();
if (!secretValues[1].isContextSpecific((byte)0)) {
throw new IOException(
@ -2271,6 +2286,9 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
byte[] encoded = attrSet[j].toByteArray();
DerInputStream as = new DerInputStream(encoded);
DerValue[] attrSeq = as.getSequence(2);
if (attrSeq.length != 2) {
throw new IOException("Invalid length for Attribute");
}
ObjectIdentifier attrId = attrSeq[0].getOID();
DerInputStream vs =
new DerInputStream(attrSeq[1].toByteArray());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2020, 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
@ -261,7 +261,7 @@ public final class OCSPResponse {
DerInputStream basicOCSPResponse =
new DerInputStream(derIn.getOctetString());
DerValue[] seqTmp = basicOCSPResponse.getSequence(2);
DerValue[] seqTmp = basicOCSPResponse.getSequence(3);
if (seqTmp.length < 3) {
throw new IOException("Unexpected BasicOCSPResponse value");
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2020, 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
@ -312,15 +312,15 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
if (generalized) {
type = "Generalized";
year = 1000 * Character.digit((char)buf[pos++], 10);
year += 100 * Character.digit((char)buf[pos++], 10);
year += 10 * Character.digit((char)buf[pos++], 10);
year += Character.digit((char)buf[pos++], 10);
year = 1000 * toDigit(buf[pos++], type);
year += 100 * toDigit(buf[pos++], type);
year += 10 * toDigit(buf[pos++], type);
year += toDigit(buf[pos++], type);
len -= 2; // For the two extra YY
} else {
type = "UTC";
year = 10 * Character.digit((char)buf[pos++], 10);
year += Character.digit((char)buf[pos++], 10);
year = 10 * toDigit(buf[pos++], type);
year += toDigit(buf[pos++], type);
if (year < 50) // origin 2000
year += 2000;
@ -328,17 +328,17 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
year += 1900; // origin 1900
}
month = 10 * Character.digit((char)buf[pos++], 10);
month += Character.digit((char)buf[pos++], 10);
month = 10 * toDigit(buf[pos++], type);
month += toDigit(buf[pos++], type);
day = 10 * Character.digit((char)buf[pos++], 10);
day += Character.digit((char)buf[pos++], 10);
day = 10 * toDigit(buf[pos++], type);
day += toDigit(buf[pos++], type);
hour = 10 * Character.digit((char)buf[pos++], 10);
hour += Character.digit((char)buf[pos++], 10);
hour = 10 * toDigit(buf[pos++], type);
hour += toDigit(buf[pos++], type);
minute = 10 * Character.digit((char)buf[pos++], 10);
minute += Character.digit((char)buf[pos++], 10);
minute = 10 * toDigit(buf[pos++], type);
minute += toDigit(buf[pos++], type);
len -= 10; // YYMMDDhhmm
@ -350,12 +350,16 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
millis = 0;
if (len > 2) {
second = 10 * Character.digit((char)buf[pos++], 10);
second += Character.digit((char)buf[pos++], 10);
second = 10 * toDigit(buf[pos++], type);
second += toDigit(buf[pos++], type);
len -= 2;
// handle fractional seconds (if present)
if (buf[pos] == '.' || buf[pos] == ',') {
if (generalized && (buf[pos] == '.' || buf[pos] == ',')) {
len --;
if (len == 0) {
throw new IOException("Parse " + type +
" time, empty fractional part");
}
pos++;
int precision = 0;
while (buf[pos] != 'Z' &&
@ -363,8 +367,13 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
buf[pos] != '-') {
// Validate all digits in the fractional part but
// store millisecond precision only
int thisDigit = Character.digit((char)buf[pos], 10);
int thisDigit = toDigit(buf[pos], type);
precision++;
len--;
if (len == 0) {
throw new IOException("Parse " + type +
" time, invalid fractional part");
}
pos++;
switch (precision) {
case 1:
@ -382,7 +391,6 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
throw new IOException("Parse " + type +
" time, empty fractional part");
}
len -= precision;
}
} else
second = 0;
@ -412,10 +420,13 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
switch (buf[pos++]) {
case '+':
hr = 10 * Character.digit((char)buf[pos++], 10);
hr += Character.digit((char)buf[pos++], 10);
min = 10 * Character.digit((char)buf[pos++], 10);
min += Character.digit((char)buf[pos++], 10);
if (len != 5) {
throw new IOException("Parse " + type + " time, invalid offset");
}
hr = 10 * toDigit(buf[pos++], type);
hr += toDigit(buf[pos++], type);
min = 10 * toDigit(buf[pos++], type);
min += toDigit(buf[pos++], type);
if (hr >= 24 || min >= 60)
throw new IOException("Parse " + type + " time, +hhmm");
@ -424,10 +435,13 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
break;
case '-':
hr = 10 * Character.digit((char)buf[pos++], 10);
hr += Character.digit((char)buf[pos++], 10);
min = 10 * Character.digit((char)buf[pos++], 10);
min += Character.digit((char)buf[pos++], 10);
if (len != 5) {
throw new IOException("Parse " + type + " time, invalid offset");
}
hr = 10 * toDigit(buf[pos++], type);
hr += toDigit(buf[pos++], type);
min = 10 * toDigit(buf[pos++], type);
min += toDigit(buf[pos++], type);
if (hr >= 24 || min >= 60)
throw new IOException("Parse " + type + " time, -hhmm");
@ -436,6 +450,9 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
break;
case 'Z':
if (len != 1) {
throw new IOException("Parse " + type + " time, invalid format");
}
break;
default:
@ -443,4 +460,16 @@ class DerInputBuffer extends ByteArrayInputStream implements Cloneable {
}
return new Date(time);
}
/**
* Converts byte (represented as a char) to int.
* @throws IOException if integer is not a valid digit in the specified
* radix (10)
*/
private static int toDigit(byte b, String type) throws IOException {
if (b < '0' || b > '9') {
throw new IOException("Parse " + type + " time, invalid format");
}
return b - '0';
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2020, 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
@ -32,6 +32,7 @@ import java.util.*;
import java.security.Principal;
import java.security.cert.*;
import java.text.Normalizer;
import javax.security.auth.x500.X500Principal;
import javax.net.ssl.SNIHostName;
@ -220,7 +221,12 @@ public class HostnameChecker {
(X500Name.commonName_oid);
if (derValue != null) {
try {
if (isMatched(expectedName, derValue.getAsString())) {
String cname = derValue.getAsString();
if (!Normalizer.isNormalized(cname, Normalizer.Form.NFKC)) {
throw new CertificateException("Not a formal name "
+ cname);
}
if (isMatched(expectedName, cname)) {
return;
}
} catch (IOException e) {

View File

@ -53,6 +53,26 @@ import java.util.Arrays;
final public
class ObjectIdentifier implements Serializable
{
/*
* The maximum encoded OID length, excluding the ASN.1 encoding tag and
* length.
*
* In theory, there is no maximum size for OIDs. However, there are some
* limitation in practice.
*
* RFC 5280 mandates support for OIDs that have arc elements with values
* that are less than 2^28 (that is, they MUST be between 0 and
* 268,435,455, inclusive), and implementations MUST be able to handle
* OIDs with up to 20 elements (inclusive). Per RFC 5280, an encoded
* OID should be less than 80 bytes for safe interoperability.
*
* This class could be used for protocols other than X.509 certificates.
* To be safe, a relatively large but still reasonable value is chosen
* as the restriction in JDK.
*/
private static final int MAXIMUM_OID_SIZE = 4096; // 2^12
/**
* We use the DER value (no tag, no length) as the internal format
* @serial
@ -115,7 +135,13 @@ class ObjectIdentifier implements Serializable
if (componentLen > comp.length) {
componentLen = comp.length;
}
// Check the estimated size before it is too later.
checkOidSize(componentLen);
init(comp, componentLen);
} else {
checkOidSize(encoding.length);
}
}
@ -198,6 +224,8 @@ class ObjectIdentifier implements Serializable
}
start = end + 1;
count++;
checkOidSize(pos);
} while (end != -1);
checkCount(count);
@ -260,11 +288,13 @@ class ObjectIdentifier implements Serializable
);
int len = in.getDefiniteLength();
checkOidSize(len);
if (len > in.available()) {
throw new IOException("ObjectIdentifier() -- length exceeds" +
throw new IOException("ObjectIdentifier length exceeds " +
"data available. Length: " + len + ", Available: " +
in.available());
}
encoding = new byte[len];
in.getBytes(encoding);
check(encoding);
@ -278,26 +308,32 @@ class ObjectIdentifier implements Serializable
ObjectIdentifier (DerInputBuffer buf) throws IOException
{
DerInputStream in = new DerInputStream(buf);
encoding = new byte[in.available()];
int len = in.available();
checkOidSize(len);
encoding = new byte[len];
in.getBytes(encoding);
check(encoding);
}
private void init(int[] components, int length) {
private void init(int[] components, int length) throws IOException {
int pos = 0;
byte[] tmp = new byte[length*5+1]; // +1 for empty input
byte[] tmp = new byte[length * 5 + 1]; // +1 for empty input
if (components[1] < Integer.MAX_VALUE - components[0]*40)
pos += pack7Oid(components[0]*40+components[1], tmp, pos);
else {
if (components[1] < Integer.MAX_VALUE - components[0] * 40) {
pos += pack7Oid(components[0] * 40 + components[1], tmp, pos);
} else {
BigInteger big = BigInteger.valueOf(components[1]);
big = big.add(BigInteger.valueOf(components[0]*40));
big = big.add(BigInteger.valueOf(components[0] * 40));
pos += pack7Oid(big, tmp, pos);
}
for (int i=2; i<length; i++) {
for (int i = 2; i < length; i++) {
pos += pack7Oid(components[i], tmp, pos);
checkOidSize(pos);
}
encoding = new byte[pos];
System.arraycopy(tmp, 0, encoding, 0, pos);
}
@ -669,4 +705,13 @@ class ObjectIdentifier implements Serializable
"oid component #" + (i+1) + " must be non-negative ");
}
}
private static void checkOidSize(int oidLength) throws IOException {
if (oidLength > MAXIMUM_OID_SIZE) {
throw new IOException(
"ObjectIdentifier encoded length exceeds " +
"the restriction in JDK (OId length(>=): " + oidLength +
", Restriction: " + MAXIMUM_OID_SIZE + ")");
}
}
}

View File

@ -65,7 +65,7 @@
// Note: this file has been generated by a tool.
package sun.text.resources.ext;
package sun.text.resources.in;
import sun.util.resources.OpenListResourceBundle;

View File

@ -38,7 +38,11 @@ modifiedUtf8LengthOfUtf8(char* string, int length) {
int i;
new_length = 0;
for ( i = 0 ; i < length ; i++ ) {
/*
* if length < 0 or new_length becomes < 0 => string is too big
* (handled as error after the cycle).
*/
for ( i = 0 ; i < length && new_length >= 0 ; i++ ) {
unsigned byte;
byte = (unsigned char)string[i];

View File

@ -206,8 +206,10 @@ Agent_OnLoad(JavaVM *vm, char *tail, void * reserved) {
/*
* According to JVMS class name is represented as CONSTANT_Utf8_info,
* so its length is u2 (i.e. must be <= 0xFFFF).
* Negative oldLen or newLen means we got signed integer overflow
* (modifiedUtf8LengthOfUtf8 returns negative value if oldLen is negative).
*/
if (newLen > 0xFFFF) {
if (oldLen < 0 || newLen < 0 || newLen > 0xFFFF) {
fprintf(stderr, "-javaagent: Premain-Class value is too big\n");
free(jarfile);
if (options != NULL) free(options);
@ -376,8 +378,10 @@ Agent_OnAttach(JavaVM* vm, char *args, void * reserved) {
/*
* According to JVMS class name is represented as CONSTANT_Utf8_info,
* so its length is u2 (i.e. must be <= 0xFFFF).
* Negative oldLen or newLen means we got signed integer overflow
* (modifiedUtf8LengthOfUtf8 returns negative value if oldLen is negative).
*/
if (newLen > 0xFFFF) {
if (oldLen < 0 || newLen < 0 || newLen > 0xFFFF) {
fprintf(stderr, "Agent-Class value is too big\n");
free(jarfile);
if (options != NULL) free(options);

View File

@ -424,7 +424,9 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param,
if ((dxs < dxCl) || (dxs >= dwCl) || (dys < dyCl) || (dys >= dhCl)) {
dxs += dx;
dys += dy;
xLeft++;
if (xLeft < MLIB_S32_MAX) {
xLeft++;
}
if ((dxs < dxCl) || (dxs >= dwCl) || (dys < dyCl) || (dys >= dhCl))
xRight = -1;
@ -436,7 +438,9 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param,
if ((dxe < dxCl) || (dxe >= dwCl) || (dye < dyCl) || (dye >= dhCl)) {
dxe -= dx;
dye -= dy;
xRight--;
if (xRight > MLIB_S32_MIN) {
xRight--;
}
if ((dxe < dxCl) || (dxe >= dwCl) || (dye < dyCl) || (dye >= dhCl))
xRight = -1;
@ -510,7 +514,9 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param,
if ((dxs > dxCl) || (dxs <= dwCl) || (dys > dyCl) || (dys <= dhCl)) {
dxs += dx;
dys += dy;
xLeft++;
if (xLeft < MLIB_S32_MAX) {
xLeft++;
}
if ((dxs > dxCl) || (dxs <= dwCl) || (dys > dyCl) || (dys <= dhCl))
xRight = -1;
@ -522,7 +528,9 @@ mlib_status mlib_AffineEdges(mlib_affine_param *param,
if ((dxe > dxCl) || (dxe <= dwCl) || (dye > dyCl) || (dye <= dhCl)) {
dxe -= dx;
dye -= dy;
xRight--;
if (xRight > MLIB_S32_MIN) {
xRight--;
}
if ((dxe > dxCl) || (dxe <= dwCl) || (dye > dyCl) || (dye <= dhCl))
xRight = -1;

View File

@ -1443,7 +1443,7 @@ int WriteNamedColorCRD(cmsIOHANDLER* m, cmsHPROFILE hNamedColor, cmsUInt32Number
cmsUInt32Number i, nColors, nColorant;
cmsUInt32Number OutputFormat;
char ColorName[cmsMAX_PATH];
char Colorant[128];
char Colorant[512];
cmsNAMEDCOLORLIST* NamedColorList;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2020, 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
@ -1015,45 +1015,46 @@ static gint gtk2_copy_image(gint *dst, gint width, gint height)
black = (*fp_gdk_pixbuf_get_pixels)(gtk2_black_pixbuf);
stride = (*fp_gdk_pixbuf_get_rowstride)(gtk2_black_pixbuf);
padding = stride - width * 4;
if (padding >= 0 && stride > 0) {
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
int r1 = *white++;
int r2 = *black++;
int alpha = 0xff + r2 - r1;
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
int r1 = *white++;
int r2 = *black++;
int alpha = 0xff + r2 - r1;
switch (alpha) {
case 0: /* transparent pixel */
r = g = b = 0;
black += 3;
white += 3;
is_opaque = FALSE;
break;
switch (alpha) {
case 0: /* transparent pixel */
r = g = b = 0;
black += 3;
white += 3;
is_opaque = FALSE;
break;
case 0xff: /* opaque pixel */
r = r2;
g = *black++;
b = *black++;
black++;
white += 3;
break;
case 0xff: /* opaque pixel */
r = r2;
g = *black++;
b = *black++;
black++;
white += 3;
break;
default: /* translucent pixel */
r = 0xff * r2 / alpha;
g = 0xff * *black++ / alpha;
b = 0xff * *black++ / alpha;
black++;
white += 3;
is_opaque = FALSE;
is_bitmask = FALSE;
break;
}
default: /* translucent pixel */
r = 0xff * r2 / alpha;
g = 0xff * *black++ / alpha;
b = 0xff * *black++ / alpha;
black++;
white += 3;
is_opaque = FALSE;
is_bitmask = FALSE;
break;
*dst++ = (alpha << 24 | r << 16 | g << 8 | b);
}
*dst++ = (alpha << 24 | r << 16 | g << 8 | b);
white += padding;
black += padding;
}
white += padding;
black += padding;
}
return is_opaque ? java_awt_Transparency_OPAQUE :
(is_bitmask ? java_awt_Transparency_BITMASK :

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2020, 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
@ -347,8 +347,10 @@ GtkApi* gtk3_load(JNIEnv *env, const char* lib_name)
fp_cairo_image_surface_create = dl_symbol("cairo_image_surface_create");
fp_cairo_surface_destroy = dl_symbol("cairo_surface_destroy");
fp_cairo_surface_status = dl_symbol("cairo_surface_status");
fp_cairo_create = dl_symbol("cairo_create");
fp_cairo_destroy = dl_symbol("cairo_destroy");
fp_cairo_status = dl_symbol("cairo_status");
fp_cairo_fill = dl_symbol("cairo_fill");
fp_cairo_rectangle = dl_symbol("cairo_rectangle");
fp_cairo_set_source_rgb = dl_symbol("cairo_set_source_rgb");
@ -775,6 +777,9 @@ static void gtk3_init_painting(JNIEnv *env, gint width, gint height)
}
cr = fp_cairo_create(surface);
if (fp_cairo_surface_status(surface) || fp_cairo_status(cr)) {
JNU_ThrowOutOfMemoryError(env, "The surface size is too big");
}
}
/*
@ -797,16 +802,17 @@ static gint gtk3_copy_image(gint *dst, gint width, gint height)
data = (*fp_cairo_image_surface_get_data)(surface);
stride = (*fp_cairo_image_surface_get_stride)(surface);
padding = stride - width * 4;
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
int r = *data++;
int g = *data++;
int b = *data++;
int a = *data++;
*dst++ = (a << 24 | b << 16 | g << 8 | r);
if (stride > 0 && padding >= 0) {
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++) {
int r = *data++;
int g = *data++;
int b = *data++;
int a = *data++;
*dst++ = (a << 24 | b << 16 | g << 8 | r);
}
data += padding;
}
data += padding;
}
return java_awt_Transparency_TRANSLUCENT;
}

View File

@ -132,6 +132,48 @@ typedef enum {
CAIRO_FORMAT_RGB16_565 = 4
} cairo_format_t;
typedef enum _cairo_status {
CAIRO_STATUS_SUCCESS = 0,
CAIRO_STATUS_NO_MEMORY,
CAIRO_STATUS_INVALID_RESTORE,
CAIRO_STATUS_INVALID_POP_GROUP,
CAIRO_STATUS_NO_CURRENT_POINT,
CAIRO_STATUS_INVALID_MATRIX,
CAIRO_STATUS_INVALID_STATUS,
CAIRO_STATUS_NULL_POINTER,
CAIRO_STATUS_INVALID_STRING,
CAIRO_STATUS_INVALID_PATH_DATA,
CAIRO_STATUS_READ_ERROR,
CAIRO_STATUS_WRITE_ERROR,
CAIRO_STATUS_SURFACE_FINISHED,
CAIRO_STATUS_SURFACE_TYPE_MISMATCH,
CAIRO_STATUS_PATTERN_TYPE_MISMATCH,
CAIRO_STATUS_INVALID_CONTENT,
CAIRO_STATUS_INVALID_FORMAT,
CAIRO_STATUS_INVALID_VISUAL,
CAIRO_STATUS_FILE_NOT_FOUND,
CAIRO_STATUS_INVALID_DASH,
CAIRO_STATUS_INVALID_DSC_COMMENT,
CAIRO_STATUS_INVALID_INDEX,
CAIRO_STATUS_CLIP_NOT_REPRESENTABLE,
CAIRO_STATUS_TEMP_FILE_ERROR,
CAIRO_STATUS_INVALID_STRIDE,
CAIRO_STATUS_FONT_TYPE_MISMATCH,
CAIRO_STATUS_USER_FONT_IMMUTABLE,
CAIRO_STATUS_USER_FONT_ERROR,
CAIRO_STATUS_NEGATIVE_COUNT,
CAIRO_STATUS_INVALID_CLUSTERS,
CAIRO_STATUS_INVALID_SLANT,
CAIRO_STATUS_INVALID_WEIGHT,
CAIRO_STATUS_INVALID_SIZE,
CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED,
CAIRO_STATUS_DEVICE_TYPE_MISMATCH,
CAIRO_STATUS_DEVICE_ERROR,
CAIRO_STATUS_LAST_STATUS
} cairo_status_t;
/* We define all structure pointers to be void* */
typedef void GdkPixbuf;
typedef void GMainContext;
@ -363,8 +405,10 @@ static void (*fp_g_strfreev)(gchar **str_array);
static cairo_surface_t* (*fp_cairo_image_surface_create)(cairo_format_t format,
int width, int height);
static void (*fp_cairo_surface_destroy)(cairo_surface_t *surface);
static cairo_status_t (*fp_cairo_surface_status)(cairo_surface_t *surface);
static cairo_t* (*fp_cairo_create)(cairo_surface_t *target);
static void (*fp_cairo_destroy)(cairo_t *cr);
static cairo_status_t (*fp_cairo_status)(cairo_t *cr);
static void (*fp_cairo_fill)(cairo_t *cr);
static void (*fp_cairo_surface_flush)(cairo_surface_t *surface);
static void (*fp_cairo_rectangle)(cairo_t *cr, double x, double y, double width,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2020, 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
@ -23,9 +23,10 @@
* questions.
*/
#include <stdlib.h>
#include "gtk_interface.h"
#include "com_sun_java_swing_plaf_gtk_GTKEngine.h"
#include <jni_util.h>
#include <stdlib.h>
/* Static buffer for conversion from java.lang.String to UTF-8 */
static char conversionBuffer[CONV_BUFFER_SIZE];
@ -307,6 +308,11 @@ JNIEXPORT void JNICALL
Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeStartPainting(
JNIEnv *env, jobject this, jint w, jint h)
{
if (w > 0x7FFF || h > 0x7FFF || (uintptr_t)4 * w * h > 0x7FFFFFFFL) {
// Same limitation as in X11SurfaceData.c
JNU_ThrowOutOfMemoryError(env, "Can't create offscreen surface");
return;
}
gtk->gdk_threads_enter();
gtk->init_painting(env, w, h);
gtk->gdk_threads_leave();

View File

@ -51,8 +51,10 @@ import org.testng.annotations.Test;
import org.testng.annotations.DataProvider;
/* @test
* @bug 8234836
* @build SerialFilterTest
* @run testng/othervm SerialFilterTest
* @run testng/othervm -Djdk.serialSetFilterAfterRead=true SerialFilterTest
*
* @summary Test ObjectInputFilters
*/
@ -76,6 +78,10 @@ public class SerialFilterTest implements Serializable {
*/
private static final Object otherObject = Integer.valueOf(0);
// Cache value of jdk.serialSetFilterAfterRead property.
static final boolean SET_FILTER_AFTER_READ =
Boolean.getBoolean("jdk.serialSetFilterAfterRead");
/**
* DataProvider for the individual patterns to test.
* Expand the patterns into cases for each of the Std and Compatibility APIs.
@ -297,6 +303,46 @@ public class SerialFilterTest implements Serializable {
}
}
/**
* After reading some objects from the stream, setting a filter is disallowed.
* If the filter was allowed to be set, it would have unpredictable behavior.
* Objects already read would not be checked again, including class descriptors.
*
* Note: To mitigate possible incompatibility a system property can be set
* to revert to the old behavior but it re-enables the incorrect use.
*/
@Test
static void testNonSettableAfterReadObject() throws IOException, ClassNotFoundException {
String expected1 = "text1";
String expected2 = "text2";
byte[] bytes = writeObjects(expected1, expected2);
for (boolean toggle: new boolean[] {true, false}) {
try (ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bais)) {
Object actual1 = toggle ? ois.readObject() : ois.readUnshared();
Assert.assertEquals(actual1, expected1, "unexpected string");
// Attempt to set filter
ObjectInputFilter filter = new ObjectInputFilter() {
@Override
public Status checkInput(FilterInfo filterInfo) {
return null;
}
};
ObjectInputFilter.Config.setObjectInputFilter(ois, filter);
if (!SET_FILTER_AFTER_READ)
Assert.fail("Should not be able to set filter after readObject has been called");
} catch (IllegalStateException ise) {
// success, the exception was expected
if (SET_FILTER_AFTER_READ)
Assert.fail("With jdk.serialSetFilterAfterRead property set = true; " +
"should be able to set the filter after a read");
} catch (EOFException eof) {
Assert.fail("Should not reach end-of-file", eof);
}
}
}
/**
* Test that if an Objects readReadResolve method returns an array
* that the callback to the filter includes the proper array length.

View File

@ -26,7 +26,7 @@
* @test
* @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779
* 8209452 8209506 8210432 8195793 8216577 8222089 8222133 8222137 8222136
* 8223499 8225392 8232019 8234245 8233223
* 8223499 8225392 8232019 8234245 8233223 8225068 8225069
* @summary Check root CA entries in cacerts file
*/
import java.io.ByteArrayInputStream;
@ -52,12 +52,12 @@ public class VerifyCACerts {
+ File.separator + "security" + File.separator + "cacerts";
// The numbers of certs now.
private static final int COUNT = 93;
private static final int COUNT = 91;
// SHA-256 of cacerts, can be generated with
// shasum -a 256 cacerts | sed -e 's/../&:/g' | tr '[:lower:]' '[:upper:]' | cut -c1-95
private static final String CHECKSUM
= "22:AA:EB:89:4E:A4:EA:25:CA:3E:DA:0F:F1:2B:FA:05:4B:68:C5:E1:3A:F9:03:40:BF:EF:F5:13:7C:CE:BC:60";
= "60:EF:3A:F8:44:CF:79:6F:A3:55:AD:3A:80:61:A7:EE:69:2A:B4:E4:F4:01:C4:47:FF:F8:25:1E:AB:87:31:F2";
// map of cert alias to SHA-256 fingerprint
@SuppressWarnings("serial")
@ -94,8 +94,6 @@ public class VerifyCACerts {
"4F:F4:60:D5:4B:9C:86:DA:BF:BC:FC:57:12:E0:40:0D:2B:ED:3F:BC:4D:4F:BD:AA:86:E0:6A:DC:D2:A9:AD:7A");
put("utnuserfirstobjectca [jdk]",
"6F:FF:78:E4:00:A7:0C:11:01:1C:D8:59:77:C4:59:FB:5A:F9:6A:3D:F0:54:08:20:D0:F4:B8:60:78:75:E5:8F");
put("addtrustclass1ca [jdk]",
"8C:72:09:27:9A:C0:4E:27:5E:16:D0:7F:D3:B7:75:E8:01:54:B5:96:80:46:E3:1F:52:DD:25:76:63:24:E9:A7");
put("addtrustexternalca [jdk]",
"68:7F:A4:51:38:22:78:FF:F0:C8:B1:1F:8D:43:D5:76:67:1C:6E:B2:BC:EA:B4:13:FB:83:D9:65:D0:6D:2F:F2");
put("addtrustqualifiedca [jdk]",
@ -152,8 +150,6 @@ public class VerifyCACerts {
"69:DD:D7:EA:90:BB:57:C9:3E:13:5D:C8:5E:A6:FC:D5:48:0B:60:32:39:BD:C4:54:FC:75:8B:2A:26:CF:7F:79");
put("verisignclass3g5ca [jdk]",
"9A:CF:AB:7E:43:C8:D8:80:D0:6B:26:2A:94:DE:EE:E4:B4:65:99:89:C3:D0:CA:F1:9B:AF:64:05:E4:1A:B7:DF");
put("keynectisrootca [jdk]",
"42:10:F1:99:49:9A:9A:C3:3C:8D:E0:2B:A6:DB:AA:14:40:8B:DD:8A:6E:32:46:89:C1:92:2D:06:97:15:A3:32");
put("dtrustclass3ca2 [jdk]",
"49:E7:A4:42:AC:F0:EA:62:87:05:00:54:B5:25:64:B6:50:E4:F4:9E:42:E3:48:D6:AA:38:E0:39:E9:57:B1:C1");
put("dtrustclass3ca2ev [jdk]",
@ -260,12 +256,8 @@ public class VerifyCACerts {
{
// Valid until: Tue Jul 09 14:40:36 EDT 2019
add("utnuserfirstobjectca [jdk]");
// Valid until: Tue May 26 00:00:00 GMT 2020
add("keynectisrootca [jdk]");
// Valid until: Sat May 30 10:38:31 GMT 2020
add("addtrustexternalca [jdk]");
// Valid until: Sat May 30 10:48:38 GMT 2020
add("addtrustclass1ca [jdk]");
// Valid until: Sat May 30 10:44:50 GMT 2020
add("addtrustqualifiedca [jdk]");
}

View File

@ -1044,3 +1044,6 @@ c56eceecec71d0b7f8af742ba33b50a3128de58f jdk8u252-b08
094173db293ac68326b38333a3570bdb0d407b43 jdk8u262-b04
07fc22e7080d7440c5e8bea06dc36548bcb065b2 jdk8u262-b05
26690d83c12ed384b919f7c67b70d2000f999bdf jdk8u262-b06
774e6c9b92965430835ea842724348c39692c542 jdk8u262-b07
ac5fce89162167996468e6466abe5cfcc8185bde jdk8u262-b08
747fe2026aa872ee5444e6c24653d054b1aef58c jdk8u262-b09

View File

@ -1079,3 +1079,6 @@ eef87c0da03ebb76368edb3195c1c5924edda265 jdk8u262-b04
e2a7c53cfa4d3c689bb819cf7ed6bb766a62baa9 jdk8u262-b05
e2a7c53cfa4d3c689bb819cf7ed6bb766a62baa9 jdk8u272-b00
f6630163b3a2b7a136db8b78049f78aa491aaf69 jdk8u262-b06
e085d9bd4f6596c5633359d16d9bfc39ecfb1b72 jdk8u262-b07
18103a6d9d495506b71068e6886d436f98bb165c jdk8u262-b08
7348b67e1dd4786e9cd4c0472ca2802f36a2573f jdk8u262-b09