jwt::base64_decode (and also jwt::base64_uri_decode) may crash when the provided buffer does not contain any valid base64 characters while it is attempting to ignore/remove invalid characters from the end. This is easily triggered by attempting to decode a JWT token with an empty header, which is what the included test does.
After adding the new test but before fixing the code, this was the test result:
jwt::base64_decode
(and alsojwt::base64_uri_decode
) may crash when the provided buffer does not contain any valid base64 characters while it is attempting to ignore/remove invalid characters from the end. This is easily triggered by attempting to decode a JWT token with an empty header, which is what the included test does.After adding the new test but before fixing the code, this was the test result:
After the fix: