MsgPack icon indicating copy to clipboard operation
MsgPack copied to clipboard

Can't unpack empty arrays?

Open rcross-lc opened this issue 1 year ago • 3 comments

Why can't this library unpack empty array?

These lines seem to stop this case

The test sequence is simply "0x90" which should be a valid msgpack structure, but I get

[ERROR] Unpacker.h L.1944 unpackArrayContainerArray : array size mismatch: 0 must be 0

rcross-lc avatar Sep 16 '24 15:09 rcross-lc

If I simply remove the size == 0 check, everything seems to work just fine.

rcross-lc avatar Sep 16 '24 15:09 rcross-lc

I suspect maybe the size == 0 case is checking for the default initialized type_error<size_t>() that can be returned by unpackArraySize?

Maybe check if(!b_decode_success) instead of if(size == 0)?

the type_error should set b_decode_success to false

rcross-lc avatar Sep 16 '24 15:09 rcross-lc

@rcross-lc Sorry for not getting back to you sooner. This issue is one of several known problems. I have not had time to address it and have not yet been able to fix it, but I will try to do so later.

hideakitai avatar Oct 22 '24 19:10 hideakitai