Skip to content

Commit aa509a2

Browse files
committed
Fix new unpacker cannot unpack reserved ext types.
1 parent 18c906f commit aa509a2

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ Release 0.9.1 2017-8-30
706706

707707
BUG FIXES
708708
* Fix ByteArrayPacker throws IndexOutOfBoundException when the buffer remaining bytes is equal to packed scalar size. #252
709+
* Fix new unpacker cannot unpack reserved ext types.
709710

710711
Release 1.0.0-beta1 T.B.D.
711712

src/MsgPack/MessagePackByteArrayUnpacker.Unpack.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3039,7 +3039,7 @@ private bool ReadMessagePackExtendedTypeObjectCore( int length, byte[] source, r
30393039
return false;
30403040
}
30413041

3042-
result = new MessagePackExtendedTypeObject( typeCode, body );
3042+
result = MessagePackExtendedTypeObject.Unpack( typeCode, body );
30433043
return true;
30443044
}
30453045

src/MsgPack/MessagePackStreamUnpacker.Unpack.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8089,7 +8089,7 @@ private bool ReadMessagePackExtendedTypeObjectCore( int length, byte[] buffer, r
80898089
return false;
80908090
}
80918091

8092-
result = new MessagePackExtendedTypeObject( typeCode, body );
8092+
result = MessagePackExtendedTypeObject.Unpack( typeCode, body );
80938093
return true;
80948094
}
80958095

@@ -8427,7 +8427,7 @@ private async Task<AsyncReadResult<Int64OffsetValue<MessagePackExtendedTypeObjec
84278427
{
84288428
return AsyncReadResult.Fail<Int64OffsetValue<MessagePackExtendedTypeObject>>();
84298429
}
8430-
return AsyncReadResult.Success( new MessagePackExtendedTypeObject( typeCode, body ), offset );
8430+
return AsyncReadResult.Success( MessagePackExtendedTypeObject.Unpack( typeCode, body ), offset );
84318431
}
84328432

84338433
public sealed override async Task<AsyncReadResult<MessagePackExtendedTypeObject?>> ReadNullableMessagePackExtendedTypeObjectAsync( CancellationToken cancellationToken )

src/MsgPack/MessagePackUnpackerCommon.Read.ttinclude

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<#@ import namespace="System.Collections.Generic" #>
1+
<#@ import namespace="System.Collections.Generic" #>
22
<#@ import namespace="System.Globalization" #>
33
<#@ import namespace="System.Runtime.InteropServices" #><#+
44
//
@@ -618,14 +618,14 @@ private void WriteReadExt(
618618
{
619619
#>
620620

621-
result = new MessagePackExtendedTypeObject( typeCode, body );
621+
result = MessagePackExtendedTypeObject.Unpack( typeCode, body );
622622
return true;
623623
<#+
624624
}
625625
else
626626
{
627627
#>
628-
return AsyncReadResult.Success( new MessagePackExtendedTypeObject( typeCode, body ), <#= context.OffsetExpression #> );
628+
return AsyncReadResult.Success( MessagePackExtendedTypeObject.Unpack( typeCode, body ), <#= context.OffsetExpression #> );
629629
<#+
630630
}
631631
#>
@@ -1494,4 +1494,4 @@ private string ToPrimitive( Type type )
14941494
.Replace( "Boolean", "bool ")
14951495
.ToLowerInvariant();
14961496
}
1497-
#>
1497+
#>

0 commit comments

Comments
 (0)