severe bug for containers with a length of size uint8?
The case of a length of >=16 but <=255 for containers (arrays, ...) is wrongly handled. Message Pack spec (https://github.com/msgpack/msgpack/blob/master/spec.md) demands a two byte length specification for array 16. The current msgpack racket implementation only writes one byte by using integer->bytes for the of a uint8 length.
Here a corrected version for the pack-sequence function (the same would have to be done for pack-hash and pack-ext)
(: pack-sequence (-> (U VectorTop (Listof Any)) Index Output-Port Any)) (define (pack-sequence seq len out) (cond [(<= len #b00001111) (write-byte (bitwise-ior len #b10010000) out)] [(uint8? len) (write-byte #xDC out) (write-byte #x00 out) (write-bytes (integer->bytes len #f) out)] [(uint16? len) (write-byte #xDC out) (write-bytes (integer->bytes len #f) out)] [(uint32? len) (write-byte #xDD out) (write-bytes (integer->bytes len #f) out)] [else (error "A sequence may contain at most 2^32 - 1 items") ]) (cond [(list? seq) (for ([item (in-list seq)]) (pack item out))] [(vector? seq) (for ([item (in-vector seq)]) (pack item out))]))