Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to deserialize array #1

Closed
xplicit opened this issue Jan 4, 2015 · 2 comments
Closed

Fails to deserialize array #1

xplicit opened this issue Jan 4, 2015 · 2 comments

Comments

@xplicit
Copy link

xplicit commented Jan 4, 2015

This code is failed to deserialize

[Serializable]
public class ByteArray64K
{
    public byte[] Arr { get; set; }
}


class MainClass
{
    public static void Main (string[] args)
    {
        var ser = new BoisSerializer ();

        var arr = new ByteArray64K(){Arr = new byte[65536]};
        byte[] data;

        using (MemoryStream ms = new MemoryStream ()) {
            ser.Serialize (arr, ms);
            data = ms.ToArray ();
        }

        ByteArray64K des1;

        using (MemoryStream ms = new MemoryStream (data)) {
            des1=ser.Deserialize<ByteArray64K>(ms);
        }

        Console.WriteLine ("length1={0}, length2={1}", arr.Arr.Length, des1.Arr.Length);
    }
}

Result is: length1=65536, length2=0.

bois version 1.8
mono --version

Mono JIT compiler version 3.10.0 (tarball Wed Nov  5 13:32:50 UTC 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS:           __thread
SIGSEGV:       altstack
Notifications: epoll
Architecture:  x86
Disabled:      none
Misc:          softdebug 
LLVM:          supported, not enabled.
GC:            sgen
@salarcode
Copy link
Owner

Thanks for the quick report.
The bug was related to the array length you have used, ushort+1 and I believe it was a serious bug.
It is fixed in 1.8.1.

@xplicit
Copy link
Author

xplicit commented Jan 4, 2015

Thank you,

I confirm, it's working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants