Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid asset codes do not round trip from JSON<>XDR #356

Closed
leighmcculloch opened this issue Apr 5, 2024 · 1 comment · Fixed by #358
Closed

Invalid asset codes do not round trip from JSON<>XDR #356

leighmcculloch opened this issue Apr 5, 2024 · 1 comment · Fixed by #358
Assignees
Labels
bug Something isn't working

Comments

@leighmcculloch
Copy link
Member

What version are you using?

3a001b1

What did you do and what did you see?

Encode an invalid asset code that has more than four characters, where the additional characters beyond the fourth are zero:

$ echo -n '"ABCD\\\\x00"' | stellar-xdr e --type AssetCode
AAAAAkFCQ0QAAAAAAAAAAA==

$ echo -n 'AAAAAkFCQ0QAAAAAAAAAAA==' | stellar-xdr d --type AssetCode --output json
"ABCD"

$ echo -n '"ABCD"' | stellar-xdr e --type AssetCode
AAAAAUFCQ0Q=

What did you expect to see?

That the invalid asset code be preserved:

$ echo -n '"ABCD\\\\x00"' | stellar-xdr e --type AssetCode
AAAAAkFCQ0QAAAAAAAAAAA==

$ echo -n 'AAAAAkFCQ0QAAAAAAAAAAA==' | stellar-xdr d --type AssetCode --output json
"ABCD\\\\x00"

Alternatively, at least an error occur.

@leighmcculloch
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant