Yuta HIGUCHI

attempt to fix buffer underflow

- IMap#get usually returns clone of original value,
  but when the type is byte[], it returns the original value.
- During the deserialization process, Kryo temporarily modifies the input buffer,
  which may cause problem when multiple threads were reading the same value.

- applying clone only to value deserialization for now,
  since it is unlikely that caller will be modifying Map key

Change-Id: I52214ba711b4060663b0e1c451f49bdd1d472ea9
...@@ -492,7 +492,10 @@ public class SMap<K, V> implements IMap<K, V> { ...@@ -492,7 +492,10 @@ public class SMap<K, V> implements IMap<K, V> {
492 } 492 }
493 493
494 private V deserializeVal(byte[] val) { 494 private V deserializeVal(byte[] val) {
495 - return serializer.decode(val); 495 + if (val == null) {
496 + return null;
497 + }
498 + return serializer.decode(val.clone());
496 } 499 }
497 500
498 private Set<byte[]> serializeKeySet(Set<K> keys) { 501 private Set<byte[]> serializeKeySet(Set<K> keys) {
......