8277227: Better identification of OIDs

Reviewed-by: ahgross, weijun, rhalade
This commit is contained in:
Valerie Peng 2022-01-05 18:53:09 +00:00 committed by Henry Jen
parent e2f8ce9c3f
commit e6c926e028

View File

@ -365,7 +365,7 @@ public final class ObjectIdentifier implements Serializable {
if ((encoding[i] & 0x80) == 0) {
// one section [fromPos..i]
if (i - fromPos + 1 > 4) {
BigInteger big = new BigInteger(pack(encoding,
BigInteger big = new BigInteger(1, pack(encoding,
fromPos, i-fromPos+1, 7, 8));
if (fromPos == 0) {
result[which++] = 2;
@ -434,7 +434,7 @@ public final class ObjectIdentifier implements Serializable {
sb.append('.');
}
if (i - fromPos + 1 > 4) { // maybe big integer
BigInteger big = new BigInteger(
BigInteger big = new BigInteger(1,
pack(encoding, fromPos, i-fromPos+1, 7, 8));
if (fromPos == 0) {
// first section encoded with more than 4 bytes,
@ -688,6 +688,7 @@ public final class ObjectIdentifier implements Serializable {
throw new IOException("ObjectIdentifier encoded length was " +
"negative: " + oidLength);
}
if (oidLength > MAXIMUM_OID_SIZE) {
throw new IOException(
"ObjectIdentifier encoded length exceeds " +