Author: j16sdiz
Date: 2009-04-24 03:40:37 +0000 (Fri, 24 Apr 2009)
New Revision: 27277

Modified:
   trunk/freenet/src/freenet/support/Buffer.java
   trunk/freenet/src/freenet/support/ShortBuffer.java
Log:
More errror checking

Modified: trunk/freenet/src/freenet/support/Buffer.java
===================================================================
--- trunk/freenet/src/freenet/support/Buffer.java       2009-04-24 03:39:59 UTC 
(rev 27276)
+++ trunk/freenet/src/freenet/support/Buffer.java       2009-04-24 03:40:37 UTC 
(rev 27277)
@@ -68,6 +68,8 @@
        public Buffer(byte[] data, int start, int length) {
                _start = start;
                _data = data;
+               if(length < 0)
+                   throw new IllegalArgumentException();
                _length = length;
        }
 
@@ -157,4 +159,4 @@
        public int getLength() {
                return _length;
        }
-}
\ No newline at end of file
+}

Modified: trunk/freenet/src/freenet/support/ShortBuffer.java
===================================================================
--- trunk/freenet/src/freenet/support/ShortBuffer.java  2009-04-24 03:39:59 UTC 
(rev 27276)
+++ trunk/freenet/src/freenet/support/ShortBuffer.java  2009-04-24 03:40:37 UTC 
(rev 27277)
@@ -64,7 +64,7 @@
        public ShortBuffer(byte[] data, int start, int length) {
                _start = start;
                _data = data;
-               if(length > Short.MAX_VALUE)
+               if(length > Short.MAX_VALUE || length < 0)
                    throw new IllegalArgumentException();
                _length = (short)length;
        }
@@ -155,4 +155,4 @@
        public int getLength() {
                return _length;
        }
-}
\ No newline at end of file
+}

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to