--- a/jdk/test/sun/security/krb5/auto/MSOID2.java Thu Jun 04 03:38:56 2015 +0200
+++ b/jdk/test/sun/security/krb5/auto/MSOID2.java Thu Jun 04 15:29:23 2015 +0800
@@ -68,7 +68,14 @@
nt[0x1d] = (byte)0x82; // change the 1st to MS OID
// Length bytes to be tweaked
for (int pos: new int[] {3, 0xf, 0x13, 0x15, 0x17}) {
- nt[pos] = (byte)(nt[pos] + 11);
+ int newLen = (nt[pos]&0xff) + 11;
+ // The length byte at nt[pos] might overflow. It's
+ // unlikely for nt[pos-1] to overflow, which means the size
+ // of token is bigger than 65535.
+ if (newLen >= 256) {
+ nt[pos-1] = (byte)(nt[pos-1] + 1);
+ }
+ nt[pos] = (byte)newLen;
}
t = nt;
new sun.misc.HexDumpEncoder().encodeBuffer(t, System.out);