Skip to content

Commit

Permalink
fix pickle serializer handshake deserialization crash in pyrolite
Browse files Browse the repository at this point in the history
  • Loading branch information
irmen committed Jul 11, 2019
1 parent 2837d92 commit ed875ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dotnet/Razorvine.Pyrolite/Pyrolite/Pyro/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
9 changes: 5 additions & 4 deletions dotnet/Razorvine.Pyrolite/Pyrolite/Pyro/PyroProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<object,object>)result);
_processMetadata((IDictionary)result);
}

/// <summary>
/// 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.
/// </summary>
private void _processMetadata(IDictionary<object, object> result)
private void _processMetadata(IDictionary result)
{
// the collections in the result can be either an object[] or a HashSet<object> or List<object>,
// depending on the serializer and Pyro version that is used
Expand Down Expand Up @@ -385,8 +385,9 @@ protected void _handshake() {
{
case Message.MSG_CONNECTOK:
if((msg.flags & Message.FLAGS_META_ON_CONNECT) != 0) {
var response_dict = (IDictionary<object,object>)handshake_response;
_processMetadata((IDictionary<object,object>)response_dict["meta"]);
var response_dict = (IDictionary)handshake_response;

_processMetadata((IDictionary)response_dict["meta"]);
handshake_response = response_dict["handshake"];
try {
validateHandshake(handshake_response);
Expand Down
8 changes: 4 additions & 4 deletions dotnet/Razorvine.Pyrolite/Pyrolite/Pyrolite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<Authors>Irmen de Jong</Authors>
<Product>Serpent Python literal expression serialization</Product>
<PackageId>Razorvine.Pyrolite</PackageId>
<Version>4.30.0</Version>
<AssemblyVersion>4.30.0.0</AssemblyVersion>
<FileVersion>4.30.0.0</FileVersion>
<Version>4.31.0</Version>
<AssemblyVersion>4.31.0.0</AssemblyVersion>
<FileVersion>4.31.0.0</FileVersion>
<SignAssembly>true</SignAssembly>
<DelaySign>false</DelaySign>
<AssemblyOriginatorKeyFile>Pyrolite.snk</AssemblyOriginatorKeyFile>
Expand All @@ -28,7 +28,7 @@ More info about Pyro: https://pyro4.readthedocs.io/</Description>
<RepositoryUrl>https://github.com/irmen/Pyrolite.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>pyro python rpc remote-objects</PackageTags>
<PackageReleaseNotes>Support for unpickling protocol 5 pickles with out-of-band buffers (Python 3.8)</PackageReleaseNotes>
<PackageReleaseNotes>Fixed deserialization issue when pickle is used as serializer in Pyrolite (exception when deserializing the handshake dictionary)</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Razorvine.Serpent" Version="1.29.0" />
Expand Down

0 comments on commit ed875ce

Please sign in to comment.