Skip to content

Implement binary_length_from_base64 #867

@erikcorry

Description

@erikcorry

Feature request:

binary_length_from_base64 would provide the following contract:

If the input is valid base64 (including optional whitespace) it returns the exact number of output bytes needed.

Otherwise it returns some buffer size that can be used as the output buffer for base64_to_binary_safe, which will report an error causing a without buffer overflow.

The implementation amounts to counting the number of input bytes > 32 (space) and a few adjustments for the last few non-whitespace characters being '='.

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