libmir/mir-ion

IonSymbolTable fails with very large keys

ellie-idb opened this issue · 0 comments

In the MessagePack deserializer, this test fails:

/// Test map with varying key lengths
@safe pure
version(mir_ion_msgpack_test)
unittest
{
    import mir.ion.ser.msgpack : serializeMsgpack;
    import std.array : replicate;

    ubyte[string] map;
    map["c".replicate(ushort.max + 1)] = 0xFF;

    assert(serializeMsgpack(map).deserializeMsgpack!(typeof(map)) == map);
}

I've narrowed this down to this specific line where we grow the key-space.

if (_expect(nextKeyPosition + key.length + 16 > keySpace.length, false))

I believe that this if should actually be a while, otherwise we give up on growing the key-space way too early.