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

Base45Decoder should reject triplets representing integers greater than 65535 #57

Closed
jcsahnwaldt opened this issue Aug 12, 2021 · 0 comments · Fixed by #67
Closed

Base45Decoder should reject triplets representing integers greater than 65535 #57

jcsahnwaldt opened this issue Aug 12, 2021 · 0 comments · Fixed by #67
Assignees
Labels
bug Something isn't working

Comments

@jcsahnwaldt
Copy link

jcsahnwaldt commented Aug 12, 2021

Describe the bug

https://datatracker.ietf.org/doc/html/draft-faltstrom-base45-07#section-6 says:

Even though a Base45 encoded string contains only characters from the alphabet in Table 1 the following case has to be considered: The string "FGW" represents 65535 (FFFF in base 16), which is a valid encoding. The string "GGW" would represent 65536 (10000 in base 16), which is represented by more than 16 bit.

Implementations MUST reject the encoded data if it contains a triplet of characters which, when decoded, results in an unsigned integer which is greater than 65535 (ffff in base 16).

But Base45Decoder accepts triplets representing integers greater than 65535, e.g. "GGW".

Expected behaviour

Base45Decoder().decode("GGW") should throw an exception, but returns a byte array with the bytes 0x01 0x00 0x00.

Steps to reproduce the issue

println(Base45Decoder().decode("GGW").joinToString(" ") { "%02X".format(it) }) prints 01 00 00.

@jcsahnwaldt jcsahnwaldt added the bug Something isn't working label Aug 12, 2021
@jcsahnwaldt jcsahnwaldt changed the title Base45Decoder should reject triplets representing integers > 65535 Base45Decoder should reject triplets representing integers greater than 65535 Aug 12, 2021
@MykhailoNester MykhailoNester self-assigned this Nov 1, 2021
@MykhailoNester MykhailoNester mentioned this issue Nov 1, 2021
MykhailoNester added a commit that referenced this issue Nov 1, 2021
* - reject the encoded data if it contains a triplet of characters which, when decoded, results in an unsigned integer which is greater than 65535 (ffff in base 16);

* - code formatting;
herald-si added a commit to herald-si/verificac19-sdk-php that referenced this issue Nov 16, 2021
reject the encoded data if it contains a triplet of characters which, when decoded, results in an unsigned integer which is greater than 65535 (ffff in base 16);
eu-digital-green-certificates/dgca-app-core-android#57
https://datatracker.ietf.org/doc/html/draft-faltstrom-base45-07#section-6
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.

3 participants