8138638: Security tests using jdk/test/sun/security/krb5/auto/KDC.java fail intermittently with OutOfMemoryError
authorweijun
Mon, 07 Dec 2015 15:48:56 +0800
changeset 34438 9ecd0f296185
parent 34437 18ec27765b99
child 34439 fbb6e8d9611c
8138638: Security tests using jdk/test/sun/security/krb5/auto/KDC.java fail intermittently with OutOfMemoryError Reviewed-by: xuelei
jdk/test/sun/security/krb5/auto/KDC.java
--- a/jdk/test/sun/security/krb5/auto/KDC.java	Mon Dec 07 03:35:24 2015 +0000
+++ b/jdk/test/sun/security/krb5/auto/KDC.java	Mon Dec 07 15:48:56 2015 +0800
@@ -1280,7 +1280,11 @@
                         System.out.println(">>>>> TCP connection established");
                         DataInputStream in = new DataInputStream(socket.getInputStream());
                         DataOutputStream out = new DataOutputStream(socket.getOutputStream());
-                        byte[] token = new byte[in.readInt()];
+                        int len = in.readInt();
+                        if (len > 65535) {
+                            throw new Exception("Huge request not supported");
+                        }
+                        byte[] token = new byte[len];
                         in.readFully(token);
                         q.put(new Job(processMessage(token), socket, out));
                     } catch (Exception e) {