Skip to content

Commit 4ee3089

Browse files
committed
Fix ArgumentOutOfRangeException occurs when serializing members count is greater than 127. Issue #63.
This commit fixes wrong condition whether using ldc.i4.s or ldc.i4. IL specifies that an operand of x.s is i1(SIGNED 1 byte integer). This commit also includes unit testing cases.
1 parent 2246e80 commit 4ee3089

15 files changed

+8225
-1
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,4 @@ Relase 0.5.9 - 2015/2/01
219219
BUG FIXES
220220
* Fix NullReferenceException is thrown for annotated non-public members serialization/deserialization in WinRT.
221221
* Fix collection typed property which has non-public setter are not handled correctly. Issue #62.
222+
* Fix ArgumentOutOfRangeException occurs when serializing members count is greater than 127. Issue #63.

src/MsgPack/Serialization/EmittingSerializers/ILEmittingSerializerBuilder`2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ protected override ILConstruct MakeInt32Literal( TContext context, int constant
172172
}
173173
default:
174174
{
175-
if ( 0 <= constant && constant <= 255 )
175+
if ( SByte.MinValue <= constant && constant <= SByte.MaxValue )
176176
{
177177
return ILConstruct.Literal( typeof( int ), constant, il => il.EmitLdc_I4_S( unchecked( ( byte )constant ) ) );
178178
}

0 commit comments

Comments
 (0)