Concordium / concordium-reference-wallet-ios

Reference wallet for the Concordium blockchain
Apache License 2.0
11 stars 10 forks source link

Information in memo-raw files is wrongly interpreted #66

Closed concordium-cl closed 3 years ago

concordium-cl commented 3 years ago

Related to task https://github.com/Concordium/concordium-reference-wallet-ios/issues/34

Bug Description For a memo.txt with content this is a memo text in a file some characters are wrongly interpreted as type and length.

Below is the file and the old network dashboard output. memo file

The iOS output is exactly the same: IMG_4013

@abizjak explanation: The letter t's ASCII code is 116 which is 01110100 in binary. The way CBOR encoding works is it looks at the first 3 bits to determine the type, in this case the type is determined to be (3=011 ) which is string. The remaining 5 bits are 10100 which is 20 in decimal, which is interpreted as the lenght of the remaining string. Hence the remaining 20 bytes are decoded.

Steps to Reproduce

Expected Result The memo should be printed as hex value in case of invalid CBOR.

Actual Result See above.

Versions

abizjak commented 3 years ago

So basically this is related to what I was asking here https://github.com/Concordium/concordium-reference-wallet-ios/pull/57#discussion_r716933271 The decoder must ensure that the entire input was decoded, not just that the prefix was.

kristiyandobrev commented 3 years ago

@abizjak

How does a similar transaction looks on web and/or Android ?

Just for reference here is the library func that does the decoding

abizjak commented 3 years ago

It should look like displayed in this screenshot https://github.com/Concordium/concordium-reference-wallet-android/issues/33

Essentially, it should fall back to displaying hex (the same as if the decoding fails currently).

Bargsteen commented 3 years ago

This seems to have been fixed. But a new issue related to memos has appeared: https://github.com/Concordium/concordium-reference-wallet-ios/issues/77