* Shrink `DecodeError` to 32 bytes on 64-bit arch
* Nul with a single l
* fmt
* Consider feature combinations for error sizes
* Remove superfluous `any`
* fmt
* Box SystemTime in EncodeError
* Rewrite: seperated Decode and BorrowDecode
* Fixed cargo.toml issues
* Fixed clippy warning
* Removed the `impl_tuples` macro call with manually exported code
* Replaced the generated code in `impl_tuples` with the macro instead
* Implemented BorrowDecode for Box<[T]>
* Added a test to see if zoxide can be ported to bincode 2
* Added a test for Arc<str>
* Made several `Encode` implementations require `T: ?Sized`
* Implemented Decode for Arc<str>
* Added BlockedTODO links to commented out code
* Fixed clippy and lint issues
* Updated virtue dependency in fuzz lockfile
* Fixed an issue where serde would decode a sequence with an u32 instead of a usize
* Added serde to the `the_same` test for roundtrips, fixed several issues.
* Fixed backwards compatibility for result, ipv4addr and ipv6addr
* Processed feedback
* Return an error if a decoded slice length doesn't fit into usize
Bincode encodes a slice length, which is an usize, as an u64. When such
an encoded slice length needs to be decoded it again uses an u64 but
critically it truncates it into an usize.
An usize is architecture dependent, it is the size how many bytes it takes to
reference any location in memory. The most common sizes for an usize are 64, 32,
and 16 bit.
This might lead to silent data loss if the architecture that encoded the
slice differs from the architecture that decoded the slice, i.e. if we
go from a 64 bit architecture to a 32 or 16 bit one.
Since bincode aims to be suitable for storage, aiming to support the
exchange of data between different architectures silently truncating
such slice lenghts should be avoided.
This patch changes the behaviour to error out if we try to decode an
slice lenght that can't fit into the current usize type.
* Remove another two usize truncations
* Rename the error variant if the usize doesn't fit anymore
Co-authored-by: Trangar <victor.koenders@gmail.com>
* Added Limit<N> and NoLimit to the configuration
* Added a limit check to Decoder and DecoderImpl
* Added test cases, added a helper function specialized for containers
* Added a test to see if inlining makes the limit config faster, added inlining to the decoder
* Made bincode_derive handle empty lines of docs correctly
* Made bincode_derive properly support const generics
* Added support for enums with variants with fixed values