lnd.xprv/tlv
Conner Fromknecht e6fdfbb1cb
tlv/truncated: fix decoding bug in DTUint16 and DTUint32
This commit fixes a bug in DTUint16 and DTUint32, which would cause them
to read too many bytes from the reader. This is due to the fact that
ReadFull was being called on a slice that could be greater than the
underlying type. This is not an issue for DTUint64, since the 8-byte
buffer corresponds to the maximum possible size of a uint64. The
solution is to clamp the buffer to 2 and 4 bytes respectively.

A series of tests are also added to exercise these cases.
2019-08-07 19:42:15 -07:00
..
bench_test.go tlv/bench_test: add basic benchmark 2019-08-07 15:04:20 -07:00
primitive.go tlv: zero alloc encoding for extended types 2019-08-07 15:04:08 -07:00
record.go tlv/record: adds various tlv record constructors 2019-08-07 15:03:43 -07:00
stream.go tlv/stream: adds tlv stream encoding/decoding 2019-08-07 15:03:56 -07:00
tlv_test.go tlv/tlv_test: add BOLT1 test vectors 2019-08-07 15:04:45 -07:00
truncated_test.go tlv/truncated: fix decoding bug in DTUint16 and DTUint32 2019-08-07 19:42:15 -07:00
truncated.go tlv/truncated: fix decoding bug in DTUint16 and DTUint32 2019-08-07 19:42:15 -07:00
varint_test.go tlv/varint_test: add tests vectors for custom Read/WriteVarInt 2019-08-07 15:03:18 -07:00
varint.go tlv/varint: add modified bitcoin varint 2019-08-07 15:03:05 -07:00