Fix infinite loop in Record.decode on corrupt header_size
When a malformed record has header_size larger than the payload,
parse_types looped forever because Varint.decode silently returned
consumed=0 at end-of-buffer, so the offset never advanced — each
iteration allocated a cons cell, eating all RAM.
Two fixes:
- Varint.decode: raise on out-of-bounds offset instead of returning (0,0)
- Record.decode: validate header_size <= payload length before looping