base58 icon indicating copy to clipboard operation
base58 copied to clipboard

Overflow on decoding long data

Open akoptelov opened this issue 4 years ago • 0 comments

Decoding of long data may lead to panic, e.g. 1111...111 (133 times) which is encoding of 133 zero bytes.

        let data = [0; 133];
        let encoded = data.to_base58();
        encoded.from_base58().unwrap();

Debug build reports attempt to subtract with overflow, while Release issues range start index 18446744073709551615 out of range for slice of length 132.

It is mentioned here that this works only for data up to 128 bytes, but probably it should be stated more clearly and handled via Result.

akoptelov avatar Jan 14 '21 12:01 akoptelov