From 754b0ca594680502727eb71da755d6a41c9d210f Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Sat, 21 Aug 2010 06:23:29 +0000 Subject: Handle more string corruption cases. --- src/main/java/com/amazon/carbonado/raw/DataDecoder.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main/java/com') 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) { -- cgit v1.2.3