diff options
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/amazon/carbonado/raw/DataDecoder.java | 12 |
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) {
|