From ed875ce521712a3c9cb0f8002612c033afec7284 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Thu, 11 Jul 2019 03:40:17 +0200 Subject: [PATCH] fix pickle serializer handshake deserialization crash in pyrolite --- dotnet/Razorvine.Pyrolite/Pyrolite/Pyro/Config.cs | 2 +- dotnet/Razorvine.Pyrolite/Pyrolite/Pyro/PyroProxy.cs | 9 +++++---- dotnet/Razorvine.Pyrolite/Pyrolite/Pyrolite.csproj | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/dotnet/Razorvine.Pyrolite/Pyrolite/Pyro/Config.cs b/dotnet/Razorvine.Pyrolite/Pyrolite/Pyro/Config.cs index 8e60bf5..b9b1f94 100644 --- a/dotnet/Razorvine.Pyrolite/Pyrolite/Pyro/Config.cs +++ b/dotnet/Razorvine.Pyrolite/Pyrolite/Pyro/Config.cs @@ -25,7 +25,7 @@ public enum SerializerType { public static bool METADATA = true; public const int PROTOCOL_VERSION = 48; // Pyro 4.38+ - public const string PYROLITE_VERSION="4.30"; + public const string PYROLITE_VERSION="4.31"; public const string DAEMON_NAME = "Pyro.Daemon"; } diff --git a/dotnet/Razorvine.Pyrolite/Pyrolite/Pyro/PyroProxy.cs b/dotnet/Razorvine.Pyrolite/Pyrolite/Pyro/PyroProxy.cs index eb98164..5253f08 100644 --- a/dotnet/Razorvine.Pyrolite/Pyrolite/Pyro/PyroProxy.cs +++ b/dotnet/Razorvine.Pyrolite/Pyrolite/Pyro/PyroProxy.cs @@ -115,14 +115,14 @@ protected void GetMetadata(string objectId) { object result = internal_call("get_metadata", Config.DAEMON_NAME, 0, false, objectId); if(result==null) return; - _processMetadata((IDictionary)result); + _processMetadata((IDictionary)result); } /// /// Extract meta data and store it in the relevant properties on the proxy. /// If no attribute or method is exposed at all, throw an exception. /// - private void _processMetadata(IDictionary result) + private void _processMetadata(IDictionary result) { // the collections in the result can be either an object[] or a HashSet or List, // depending on the serializer and Pyro version that is used @@ -385,8 +385,9 @@ protected void _handshake() { { case Message.MSG_CONNECTOK: if((msg.flags & Message.FLAGS_META_ON_CONNECT) != 0) { - var response_dict = (IDictionary)handshake_response; - _processMetadata((IDictionary)response_dict["meta"]); + var response_dict = (IDictionary)handshake_response; + + _processMetadata((IDictionary)response_dict["meta"]); handshake_response = response_dict["handshake"]; try { validateHandshake(handshake_response); diff --git a/dotnet/Razorvine.Pyrolite/Pyrolite/Pyrolite.csproj b/dotnet/Razorvine.Pyrolite/Pyrolite/Pyrolite.csproj index 6780818..de1feac 100644 --- a/dotnet/Razorvine.Pyrolite/Pyrolite/Pyrolite.csproj +++ b/dotnet/Razorvine.Pyrolite/Pyrolite/Pyrolite.csproj @@ -8,9 +8,9 @@ Irmen de Jong Serpent Python literal expression serialization Razorvine.Pyrolite - 4.30.0 - 4.30.0.0 - 4.30.0.0 + 4.31.0 + 4.31.0.0 + 4.31.0.0 true false Pyrolite.snk @@ -28,7 +28,7 @@ More info about Pyro: https://pyro4.readthedocs.io/ https://github.com/irmen/Pyrolite.git git pyro python rpc remote-objects - Support for unpickling protocol 5 pickles with out-of-band buffers (Python 3.8) + Fixed deserialization issue when pickle is used as serializer in Pyrolite (exception when deserializing the handshake dictionary)