jdk/src/java.base/share/classes/java/net/SocketInputStream.java
changeset 43202 29180c8db039
parent 32649 2ee9017c7597
child 44534 a076dffbc2c1
--- a/jdk/src/java.base/share/classes/java/net/SocketInputStream.java	Tue Sep 13 00:20:17 2016 +0000
+++ b/jdk/src/java.base/share/classes/java/net/SocketInputStream.java	Tue Sep 13 11:59:56 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2016, 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
@@ -155,11 +155,12 @@
         }
 
         // bounds check
-        if (length <= 0 || off < 0 || off + length > b.length) {
+        if (length <= 0 || off < 0 || length > b.length - off) {
             if (length == 0) {
                 return 0;
             }
-            throw new ArrayIndexOutOfBoundsException();
+            throw new ArrayIndexOutOfBoundsException("length == " + length
+                    + " off == " + off + " buffer length == " + b.length);
         }
 
         boolean gotReset = false;