@@ -0,0 +1,1463 @@
+#!/usr/bin/env python%0A# coding: utf-8%0A%0Afrom nose import main%0Afrom nose.tools import *%0A%0Aimport StringIO%0Aimport msgpack%0A%0Abinarydata = %5Bchr(i) for i in xrange(256)%5D%0Abinarydata = %22%22.join(binarydata)%0A%0Adef gen_binary_data(idx):%0A    data = binarydata%5B:idx %25 300%5D%0A    return data%0A%0Adef test_exceeding_unpacker_read_size():%0A    dumpf = StringIO.StringIO()%0A%0A    packer = msgpack.Packer()%0A%0A    NUMBER_OF_STRINGS = 6%0A    read_size = 16%0A                                # 5 ok for read_size=16, while 6 glibc detected *** python: double free or corruption (fasttop):%0A                                # 20 ok for read_size=256, while 25 segfaults / glibc detected *** python: double free or corruption (!prev)%0A                                # 40 ok for read_size=1024, while 50 introduces errors%0A                                # 7000 ok for read_size=1024*1024, while 8000 leads to  glibc detected *** python: double free or corruption (!prev):%0A%0A    for idx in xrange(NUMBER_OF_STRINGS):%0A        data = gen_binary_data(idx)%0A        dumpf.write(packer.pack(data))%0A%0A    f = StringIO.StringIO(dumpf.getvalue())%0A    dumpf.close()%0A%0A    unpacker = msgpack.Unpacker(f, read_size=read_size)%0A%0A    read_count = 0%0A    for idx, o in enumerate(unpacker):%0A        assert_equal(type(o), str)%0A        assert_equal(o, gen_binary_data(idx))%0A        read_count += 1%0A%0A    assert_equal(read_count, NUMBER_OF_STRINGS)%0A%0A%0Aif __name__ == '__main__':%0A    # main()%0A    test_exceeding_unpacker_read_size()%0A

Add test for issue29.