changeset 23351:1c62a8bac25a

Throw exception in IGV if ensureAvailable is called with too large a size
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Tue, 19 Apr 2016 21:36:49 -0700
parents 5e8be3095c53
children 3848113e3e6b 30af491f98c5
files src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/BinaryParser.java
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/BinaryParser.java	Mon Apr 18 10:18:48 2016 -0700
+++ b/src/share/tools/IdealGraphVisualizer/Data/src/com/sun/hotspot/igv/data/serialization/BinaryParser.java	Tue Apr 19 21:36:49 2016 -0700
@@ -302,6 +302,9 @@
     }
     
     private void ensureAvailable(int i) throws IOException {
+        if (i > buffer.capacity()) {
+            throw new IllegalArgumentException(String.format("Can not request %d bytes: buffer capacity is %d", i, buffer.capacity()));
+        }
         while (buffer.remaining() < i) {
             fill();
         }