Skip to content

Validate base64 input and avoid unwrap panic #81

@peter-jerry-ye

Description

@peter-jerry-ye

base64_decode assumes well-formed input and uses unwrap on get_char, which will panic on invalid indices or malformed strings. It also silently accepts invalid characters.

Suggested fix: validate input length (multiple of 4), handle invalid characters gracefully, and return an error (or Option/Result) instead of panicking.

Refs: lib/json_utils.mbt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions