summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian S. O'Neill <bronee@gmail.com>2010-08-21 06:23:29 +0000
committerBrian S. O'Neill <bronee@gmail.com>2010-08-21 06:23:29 +0000
commit754b0ca594680502727eb71da755d6a41c9d210f (patch)
tree0e1a1cc30c5d8fe3875d9246f8c89c226a845888 /src
parentc270234f37f0d9bdb1755f22561cbcba156b6e8c (diff)
Handle more string corruption cases.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/amazon/carbonado/raw/DataDecoder.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/java/com/amazon/carbonado/raw/DataDecoder.java b/src/main/java/com/amazon/carbonado/raw/DataDecoder.java
index 4514ec1..7e4f932 100644
--- a/src/main/java/com/amazon/carbonado/raw/DataDecoder.java
+++ b/src/main/java/com/amazon/carbonado/raw/DataDecoder.java
@@ -542,7 +542,17 @@ public class DataDecoder {
return srcOffset - originalOffset;
}
- char[] value = new char[valueLength];
+ char[] value;
+ try {
+ value = new char[valueLength];
+ } catch (NegativeArraySizeException e) {
+ throw new CorruptEncodingException
+ ("Corrupt encoded string length (negative size): " + valueLength);
+ } catch (OutOfMemoryError e) {
+ throw new CorruptEncodingException
+ ("Corrupt encoded string length (too large): " + valueLength, e);
+ }
+
int valueOffset = 0;
while (valueOffset < valueLength) {