8222751: closed/test/jdk/sun/security/util/DerIndefLenConverter/IndefBerPkcs12.java fail

Reviewed-by: jnimeh, ascarpino, ssahoo, skoivu
This commit is contained in:
Weijun Wang 2019-04-23 08:34:51 +08:00
parent bac946663d
commit cd020a13c9
2 changed files with 34 additions and 34 deletions

View file

@ -92,9 +92,6 @@ class DerIndefLenConverter {
* add the current position to the <code>eocList</code> vector. * add the current position to the <code>eocList</code> vector.
*/ */
private void parseTag() throws IOException { private void parseTag() throws IOException {
if (dataPos == dataSize)
return;
try {
if (isEOC(data[dataPos]) && (data[dataPos + 1] == 0)) { if (isEOC(data[dataPos]) && (data[dataPos + 1] == 0)) {
int numOfEncapsulatedLenBytes = 0; int numOfEncapsulatedLenBytes = 0;
Object elem = null; Object elem = null;
@ -126,9 +123,6 @@ class DerIndefLenConverter {
numOfTotalLenBytes += (sectionLenBytes.length - 3); numOfTotalLenBytes += (sectionLenBytes.length - 3);
} }
dataPos++; dataPos++;
} catch (IndexOutOfBoundsException iobe) {
throw new IOException(iobe);
}
} }
/** /**
@ -336,6 +330,10 @@ class DerIndefLenConverter {
// parse and set up the vectors of all the indefinite-lengths // parse and set up the vectors of all the indefinite-lengths
while (dataPos < dataSize) { while (dataPos < dataSize) {
if (dataPos + 2 > dataSize) {
// There should be at least one tag and one length
return null;
}
parseTag(); parseTag();
len = parseLength(); len = parseLength();
if (len < 0) { if (len < 0) {

View file

@ -269,6 +269,8 @@ public class KeyStoreDelegator extends KeyStoreSpi {
throw (CertificateException)e; throw (CertificateException)e;
} else if (e instanceof NoSuchAlgorithmException) { } else if (e instanceof NoSuchAlgorithmException) {
throw (NoSuchAlgorithmException)e; throw (NoSuchAlgorithmException)e;
} else if (e instanceof RuntimeException){
throw (RuntimeException)e;
} }
} }
} }