diff options
author | janakr <janakr@google.com> | 2018-04-03 12:36:26 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-03 12:38:16 -0700 |
commit | 17e56a4d95c58911708b2e002371c14455be13b1 (patch) | |
tree | 6474b616a09ef1b57fd9d5c36eb9e07431f378fc /src/main/java | |
parent | 077c6d68fe9671835a404cf4bbfea525acf3f2da (diff) |
Don't hold on to full byte array when deserializing protocol buffers.
PiperOrigin-RevId: 191483825
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/serialization/MessageLiteCodec.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/serialization/MessageLiteCodec.java b/src/main/java/com/google/devtools/build/lib/skyframe/serialization/MessageLiteCodec.java index e7cce534c8..f5bba6da32 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/serialization/MessageLiteCodec.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/serialization/MessageLiteCodec.java @@ -53,12 +53,16 @@ public class MessageLiteCodec implements ObjectCodec<MessageLite> { @Override public MessageLite deserialize(DeserializationContext unusedContext, CodedInputStream codedIn) throws IOException, SerializationException { + // Don't hold on to full byte array when constructing this proto. + codedIn.enableAliasing(false); try { MessageLite.Builder builder = builderSupplier.get(); codedIn.readMessage(builder, ExtensionRegistryLite.getEmptyRegistry()); return builder.build(); } catch (InvalidProtocolBufferException e) { throw new SerializationException("Failed to parse proto of type " + type, e); + } finally { + codedIn.enableAliasing(true); } } } |