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 '='.
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 '='.