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

jsDecodeBase64 fails to reject short encodings #1990

Closed
gibson042 opened this issue Jan 22, 2024 · 0 comments · Fixed by #1991
Closed

jsDecodeBase64 fails to reject short encodings #1990

gibson042 opened this issue Jan 22, 2024 · 0 comments · Fixed by #1991
Labels
bug Something isn't working

Comments

@gibson042
Copy link
Contributor

Describe the bug

jsDecodeBase64 incorrectly accepts short encodings that leave bits hanging in the register, and the incorrectness is visible in Node.js.

Steps to reproduce

$ node --input-type=module -e '
  import "@endo/init";
  import { decodeBase64 } from "@endo/base64";
  console.log(decodeBase64("Z"));
  console.log(decodeBase64("V1RGZ"));
'

Expected behavior

An error.

Actual behavior

Uint8Array(0) []
Uint8Array(3) [ 87, 84, 70 ]
@gibson042 gibson042 added the bug Something isn't working label Jan 22, 2024
gibson042 added a commit that referenced this issue Jan 22, 2024
gibson042 added a commit that referenced this issue Jan 22, 2024
gibson042 added a commit that referenced this issue Jan 22, 2024
gibson042 added a commit that referenced this issue Jan 22, 2024
gibson042 added a commit that referenced this issue Jan 23, 2024
gibson042 added a commit that referenced this issue Jan 24, 2024
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